Cross reference a surname against a list of Names to get a specific result

jcrider

New Member
Joined
May 30, 2011
Messages
12
All,

Apologies, I'm sure the answer is here in the forum somewhere, and I have looked but can't find an answer which helps.

The issue:

Worktab 1

  • I have a list of user names in column A (130 of them which contains both their first name and surname).
  • I need to assign the company name for each user into column C which is currently blank.

Worktab 2

  • Contains a list of 300+ users where their names are split into two columns (Column B = First Name, Column C = Surname), together with their relevant company name in column F.

I need to reference the 'Surname' in column C (worktab 2) against the names in column A of (worktab 1), and populate column C (in worktab1) with the correct company.


I hope this makes sense?

Thanks,

JC
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
sheet1 like this

Sheet1

*AB
1first namesurname
2as
3df
4gj
5kl

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:64px;"></colgroup><tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4


sheet 2 like this

Sheet2

*ABCDEF
1hdng1first namesurname**company
2*as**w
3*df**e
4*gj**r

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"><col style="width:64px;"></colgroup><tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

formula in c2 in sheet 1 is

=VLOOKUP(B2,Sheet2!$C$2:$F$4,4,0)

formula in c2 in sheet1 is copied down.
 
Upvote 0
My take on it is this.

Excel Workbook
BCDEF
1First NameSurnameCompany
2AnnSmithCompany 1
3TimJonesCompany 2
4TomJonesCompany 3
5JenHallCompany 4
6KenSmithCompany 5
7
Sheet2




Formula in C2 copied down.

Excel Workbook
ABC
1NameCompany
2Tom JonesCompany 3
3Ann SmithCompany 1
4Fred DerfNot found
5Ken SmithCompany 5
6
Sheet1
 
Upvote 0
Thank you both for the replies.

Peter_SSs, your screenshots are exactly how the sheets looks and the formula pretty much hits the nail on the head.

The only caveat are the names. There is a lot of obscurity with the first names, for example 'Alexander' in sheet 2, but its 'Alex' in sheet 1.
This happens quite a lot and the result gives a lot of "Not found". The only constant are the surnames.

I've tried adjusting your formula to:

=IFERROR(INDEX(Sheet2!F$2:F$399,MATCH(A2,INDEX(Sheet2!C$2:C$399,0),0)),"Not found")

... but I'm having no joy. Is there something I am missing?

Thank you again,

 
Upvote 0
JC

If you are only matching on surname, I provide a formula below. However, you will get incorrect results unless those surnames are unique - as evidenced by my results below.

This is not a strength of mine, but if you want to investigate this further with a view to improving the results, you may want to be aware of member al_b_cnu's work on "fuzzy matching". It's here but be warned: there is a lot of reading with around 400 posts in the thread!!

Excel Workbook
BCDEF
1First NameSurnameCompany
2AnnSmithCompany 1
3TimJonesCompany 2
4TomJonesCompany 3
5JenHallCompany 4
6KenSmithCompany 5
Sheet2




Excel Workbook
ABCD
1NameCompany
2Tom JonesCompany 2Incorrect
3Ann SmithCompany 1
4Fred DerfNot found
5Ken SmithCompany 1Incorrect
Sheet1
 
Upvote 0
Peter,

Thank you very much for your time and effort into this. Its pretty much there with what I need.

Luckily the surnames are all unique so it pretty much does the job. I'll have a look into the fuzzy matching too.

Thank you again,

JC
 
Upvote 0

Forum statistics

Threads
1,213,562
Messages
6,114,326
Members
448,564
Latest member
ED38

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