Solved

Excel - Formula or VBA to allow matching of partial names, abbreviated names and nicknames

Posted on 2014-01-21
3
1,073 Views
Last Modified: 2014-01-21
I work in an environment were information is collected from students and manually entered into spreadsheets by a large number of different people (sometimes the students themselves).  The names of the students on the supplied spreadsheets can have 4 or 5 variations due to the use of nicknames, abbreviations, spelling errors and the like.  I would like to create a system where the supplied name can be matched to the correct and formal name of the student.  I have created a table with 5 name columns for each student.  In this table the formal name of the athlete is entered in column 2 (column 1 is an ID number) and any known abbreviations, nicknames or abbreviations are entered in columns C,D,E and F.  If the supplied name matches any of the known alternate names then a successful match can be made and the correct Formal Name and ID number applied to the data record.  I have written a match function to accomplish this but i am interested in any alternative suggestions to make this task work smoothly and cope with any new alternate names that may be entered i.e. add them to the list of alternate names.  A VBA solution is OK as the master document is already a xlsm file.  Sample file is attached.
Names-Database.xlsx
0
Comment
Question by:JohnNZExcel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 81

Assisted Solution

by:byundt
byundt earned 500 total points
ID: 39799137
The following brute force formula works for data entry into cell H1:
=INDEX(RngAthleteNames,IFERROR(MATCH(H1,RngAthleteNames,0),IFERROR(MATCH(H1,RngAltNames1,0),IFERROR(MATCH(H1,RngAltNames2,0),IFERROR(MATCH(H1,RngAltNames3,0),IFERROR(MATCH(H1,RngAltNames4,0),""))))))
0
 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 39799153
I created a named range AllNames that is the union of RngAthleteNames, RngAltNames1, RngAltNames2, RngAltNames3 and RngAltNames4. I then wrote a user-defined function (in a regular modules sheet) called FormalName. You can use it with a worksheet formula like:
=FormalName(H1, AllNames)              where H1 is the data entered by the user
Function FormalName(InputName As String, rngNames As Range)
Dim v As Variant
Dim i As Long, nCols As Long
FormalName = "Not found"
nCols = rngNames.Columns.Count
For i = 1 To nCols
    v = Application.Match(InputName, rngNames.Columns(i), 0)
    If Not IsError(v) Then
        FormalName = rngNames(CLng(v), 1).Value
        Exit Function
    End If
Next
End Function

Open in new window

0
 

Author Closing Comment

by:JohnNZExcel
ID: 39799255
Greatly appreciate you providing both an improved formulaic solution as well as a neat looking UDF.  I will work with both and see how everything goes.  Thank you, thank you!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question