Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-01-21
3
Medium Priority
?
1,154 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 2000 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
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…

730 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