Vlookup - partial and reversed text string

tpf1001

New Member
Joined
Jun 12, 2015
Messages
1
I'm trying to lookup a person's name and return an ID number (Spreadsheet 1) from another spreadsheet that has the name and ID number (Spreadsheet 2). However, the names in Spreadsheet 1 may only contain either partial text, or contain more text, slightly different text, than what is in the name column in Spreadsheet 2. I've tried using partial text vloookup, as well as other match, index-match, and other vlookup functions.

Ex.)

Spreadsheet 1
- I have a list of around 500 names that are entered into individual cells in the form (Last Name, First Name) or (Company Name); sometimes the first name or the last name, or both the first and last name, will be in the same cell as the company name (e.g., Arcane Builders Co. - Bob and Cheryl)
- I have tried taking that list of 500 names/companies and removing text that includes: spaces, commas, ampersands, etc. (e.g., Smith, Michael --> SmithMichael; Arcane Builders Co. - Bob and Cheryl --> ArcaneBuildersCoBobCheryl)

Spreadsheet 2
- I have 2 columns that correspond to around 16,500 names (Column A) with respective number IDs (Column B)
- I have also removed all spaces, commas, etc. in the name column in this spreadsheet


Spreadsheet 1

AB
1Company/NameNumber_ID
2SmithMichael=vlookup(...
3JonesSarah
4ArcaneBuildersCoBobCheryl

<tbody>
</tbody>

Spreadsheet 2

AB
1Company/NameNumber_ID
2MichaelSmith97362
3SarahJones34556
4ArcaneBuildersCo56712

<tbody>
</tbody>




- I have tried running a partial text vlookup, but I think I'm not returning nearly as many number IDs because the names are often written in reverse order in the 2 spreadsheets

=vlookup("*"&A2&"*",[Book1.xlsx]Sheet2!$A$2:$B$16464,2,false)

- This function is bringing back a lot of #NA when I know they are in the other spreadsheet, just written in reverse order

- I have also tried running Index-match functions and still no good (Not sure If I'm doing it right...)

Any suggestions?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi tpf1001,

Here's something that you might be able to try based on what you've put above.

If you have a vlookup but just looking for the first 3 letters of the name in Sheet1 against the list of names in Sheet2

Code:
=VLOOKUP("*"&LEFT(A1,3)&"*",Sheet3!A1:A3,1,0)


but to make sure you retrieve all but not more than you expect - you could put a countif in the column next to it?

Code:
=COUNTIF(Sheet3!A:A,"*"&LEFT(A1,3)&"*")

I'd even thought about using either AND or OR in your vlookup (comprising of 2 x vlookup's) to try to match criteria of first 3 letters and last 3 letters?

What do you think?

Simon
 
Upvote 0
Hi tpf1001

What I would do is go to your spreadsheet of good data (Spreadsheet2) and match back to Spreadsheet1, then look up from Spreadsheet1 to that matched column in Spreadsheet2 and return the ID if you found a match.

First use a function to split the Spreadsheet2 names into separate words (plenty of solutions are on this site if you search). Then, in each row on Spreadsheet2 look up "*"&Word1&"*"&Word2&"*"&"Word3"&"* against a new column you add to Spreadsheet1 that is the badly-formatted name repeated three times (or as many times as there are maximum words, minus one). This is similar to your technique but we are working backwards (Spreadsheet2 to Spreadsheet1) rather than forwards.

So for example, on Spreadsheet1 you have a cell that says "Smith Michael" as the original name, a cell next to it that says "Smith Michael Smith Michael Smith Michael" from repeating the cell (use the REPT() function or =A2&A2&A2 or whatever), and then on Spreadsheet2 you are doing a MATCH("*Michael*Smith**", YourSpreadsheet1RepeatedNames, 0). You then need to look up from Spreadsheet1 to Spreadsheet2 to see for each row if the MATCH() is present, and if so return the appropriate ID.

Hope that helps - it's not an ideal solution but should work for most cases. Let me know if the above is confusing for you, it's not very well written, sorry!

Mackers
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,467
Messages
6,124,984
Members
449,201
Latest member
Lunzwe73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top