Index Match question

sunrise06

Active Member
Joined
Oct 27, 2006
Messages
264
Office Version
  1. 365
Platform
  1. Windows
I have one spreadsheet that has Last Name, First Name in one cell. I have another spreadsheet where I have ID#, Last Name, Middle Initial, First Name each in separate cells.

I would like to use INDEX and MATCH formulas to bring over ID# to the first spreadsheet. Is this possible?

Thanks!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
If you have unique combination of last and first name then you should be able to use index match to do that. If there is a duplicate then match will return the first match it find.


Book1
ABC
1last namefirst nameid#
2lname1fname11
3lname2fname22
4lname3fname33
5lname4fname44
6lname5fname55
7lname6fname66
Sheet1
Cell Formulas
RangeFormula
C2{=INDEX(Sheet2!A2:A7,MATCH(Sheet1!A2&Sheet1!B2,Sheet2!B2:B7&Sheet2!C2:C7,0))}
C3{=INDEX(Sheet2!A3:A8,MATCH(Sheet1!A3&Sheet1!B3,Sheet2!B3:B8&Sheet2!C3:C8,0))}
C4{=INDEX(Sheet2!A4:A9,MATCH(Sheet1!A4&Sheet1!B4,Sheet2!B4:B9&Sheet2!C4:C9,0))}
C5{=INDEX(Sheet2!A5:A10,MATCH(Sheet1!A5&Sheet1!B5,Sheet2!B5:B10&Sheet2!C5:C10,0))}
C6{=INDEX(Sheet2!A6:A11,MATCH(Sheet1!A6&Sheet1!B6,Sheet2!B6:B11&Sheet2!C6:C11,0))}
C7{=INDEX(Sheet2!A7:A12,MATCH(Sheet1!A7&Sheet1!B7,Sheet2!B7:B12&Sheet2!C7:C12,0))}
Press CTRL+SHIFT+ENTER to enter array formulas.



Book1
ABC
1id#last namefirst name
21lname1fname1
32lname2fname2
43lname3fname3
54lname4fname4
65lname5fname5
76lname6fname6
Sheet2
 
Upvote 0
Thank you for this however on Sheet 1 I only have Last Name, First Name in just once cell.
 
Upvote 0
Can you post a sample of your data (both sheets)?
 
Last edited:
Upvote 0

Book1
AB
1NameID# Lookup
2Smith, John
3Brown, Charlie
4Sample, Sam
Sheet1



Book1
ABC
1ID#LastFirst
2101SmithJohn
3102BrownCharlie
4103SampleSam
Sheet2
 
Last edited:
Upvote 0
Something like should work. However in order to get a match the names need to be the same so if you have Smith, John in sheet one but Smith John M. in sheet 2 a match would not be found. The names in sheet two must match sheet one when put in the lastname, firstname format.


Book1
AB
1NameID# Lookup
2Smith, John101
3Brown, Charlie102
4Sample, Sam103
Sheet1
Cell Formulas
RangeFormula
B2{=INDEX(Sheet2!$A$2:$A$4,MATCH(Sheet1!A2,Sheet2!$B$2:$B$4&", "&Sheet2!$C$2:$C$4,0))}
B3{=INDEX(Sheet2!$A$2:$A$4,MATCH(Sheet1!A3,Sheet2!$B$2:$B$4&", "&Sheet2!$C$2:$C$4,0))}
B4{=INDEX(Sheet2!$A$2:$A$4,MATCH(Sheet1!A4,Sheet2!$B$2:$B$4&", "&Sheet2!$C$2:$C$4,0))}
Press CTRL+SHIFT+ENTER to enter array formulas.



Book1
ABC
1ID#LastFirst
2101SmithJohn
3102BrownCharlie
4103SampleSam
Sheet2
 
Upvote 0
So I was able to get this to work for my specific situation. The example I provided you was just a test. What I am finding interesting is that if I sort my sheet 1, the lookup values all change. It seems the lookup number value in the match statement is not refreshing to the new row once sorted. In other words, if I have "MATCH(Sheet1!A101" in row 101 but sort so that it is now in row 2, "MATCH(Sheet1!A101" does not update to say "MATCH(Sheet1!A2".

Any ideas?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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