Search code examples
excelexcel-formulavlookup

How can I use VLookup to match data from 2 sheets onto a 3rd sheet?


On sheetA I have a column of names. On sheetB I have those names in a column paired with an ID.

On sheetC I want to have a new column that takes the names from sheetA, matches them with the names on sheetB and returns the relevant ID.

I've been trying to achieve this with vlookup but can't quite figure it out. So far on sheetC I have:

=xlookup(A3,SheetA!$A$1:$A$600,SheetB!$B$1:$B$600,"not found")

The result I want is as follows:

sheetA

A
John Smith
Jane Doe
Joe Blow
John Smith
John Smith

sheetB

A B
John Smith 0001
Jane Doe 0002
Joe Blow 0003

sheetC - desired outcome

A
0001
0002
0003
0001
0001

Would anyone be able to point me in the right direction?


Solution

  • You lookup value A3 seems incorrect. Try-

    =XLOOKUP(SheetA!A1,SheetB!$A$2:$A$2000,SheetB!$B$2:$B$2000)
    

    enter image description here