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
 

Some videos you may like

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

venkat1926

Well-known Member
Joined
Aug 21, 2005
Messages
4,824
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.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
46,165
Office Version
  1. 365
Platform
  1. Windows
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
 

jcrider

New Member
Joined
May 30, 2011
Messages
12
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,

 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
46,165
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

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
 

jcrider

New Member
Joined
May 30, 2011
Messages
12
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
 

Watch MrExcel Video

Forum statistics

Threads
1,108,708
Messages
5,524,428
Members
409,577
Latest member
Dwg

This Week's Hot Topics

Top