Solved

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

Posted on 2014-01-21
3
986 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
  • 2
3 Comments
 
LVL 80

Assisted Solution

by:byundt
byundt earned 500 total points
Comment Utility
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 80

Accepted Solution

by:
byundt earned 500 total points
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This is an explanation of a simple data model to help parse a JSON feed
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now