+ Reply to Thread
Results 1 to 5 of 5

Check name against different spellings list

Hybrid View

  1. #1
    Registered User
    Join Date
    11-13-2008
    Location
    Dunfermline, Scotland
    Posts
    25

    Check name against different spellings list

    This kind of relates to my post at http://www.excelforum.com/excel-prog...ml#post2003473.

    I have 2 worksheets.
    Column A on both contains a forename
    Column B on both contains a surname.

    I have a macro which runs through all the rows on Sheet1 and checks the forename and surname against all the rows in Sheet2. If a match is found, that row is copied onto the same row on Sheet3.

    The problem we have is that in 1 sheet a name might be
    A B
    Tommy Jones

    and on the other the same person is in under
    A B
    Tom Jones

    What would the best way be to pick out these irregularities, I.e. still have the code pick the above out as a match and copy the row to Sheet3

    Sub checkAssystAgainstEdir()
        Dim iAssyst As Long, iEdir As Long, countassyst As Long, countedir As Long
        Dim assystfn As String
        Dim assystsn As String
        Dim edirfn As String
        Dim edirsn As String
        countassyst = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
        countedir = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
        For iAssyst = 2 To countassyst Step 1
            assystfn = Cells(iAssyst, 1)
            assystsn = Cells(iAssyst, 2)
            For iEdir = 2 To countedir Step 1
                edirfn = Sheets("Sheet2").Cells(iEdir, 3)
                edirsn = Sheets("Sheet2").Cells(iEdir, 2)
                If assystfn = edirfn And assystsn = edirsn Then
                    Exit For
                End If
                If iEdir = countedir Then
                    Sheets("Sheet1").Rows(iAssyst).Select
                    Selection.Copy
                    Sheets("Sheet3").Rows(iAssyst).Insert
                End If
            Next
        Next
        'Tidy up sheet3
        DeleteBlankRows ("Sheet3")
    End Sub
    Any help is greatly appreciated

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello dopple,

    The problem I see with sorting this out is you really don't have enough information to determine if the names really are the same. You could have a Tom and Tommy who are two different people. How are deciding this or are you certain all short forms of a given name are the same?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    11-13-2008
    Location
    Dunfermline, Scotland
    Posts
    25
    I am also searching against the surname field.
    So in pseudo code
    If ( ( (forename1 <> forename2 ) AND ( forename1 meets no criteria in the exceptions list ) ) AND ( surname <> surname ) )
        DO whatever
    END IF
    Last edited by dopple; 11-28-2008 at 05:58 AM. Reason: fixed messed up pseudocode

  4. #4
    Registered User
    Join Date
    11-13-2008
    Location
    Dunfermline, Scotland
    Posts
    25
    Also I should add that these are just to throw up any possible exceptions in order to clean up our data sources so even if a few do ghet through the script, it will only be acted on after a secondary check, thus avoiding any duplication, or accidental de-duplication of two genuine people with the sme name.

  5. #5
    Registered User
    Join Date
    11-13-2008
    Location
    Dunfermline, Scotland
    Posts
    25
    bumpety bump

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1