What's wrong is that VLOOKUP
is looking for the phone number in the first column, meaning in column A. For 'backwards lookup', you will need to use INDEX
and MATCH
:
=INDEX(Phonebook!$A$2:$A$45,MATCH(B2,Phonebook!$B$2:$B$45,0))
INDEX
is as follows:
=INDEX(Range, Row Number, [Column Number])
It will return the value a cell from the range Range
that is on the row number Row Number
and column Column Number
. I have put Column Number
between square brackets because it is optional (you have only 1 column if you have a range that is within A:A for example)
To get the row number, you can use MATCH
like the above. It works a bit like VLOOKUP
, but instead of returning the value of the matching cell, it returns the row number of the matching cell (or column number if you use it on a horizontal range).
MATCH(B2,Phonebook!$B$2:$B$45,0)
thus looks for B2
in the range B2:B45
of the worksheet Phonebook
(0
stands for exact match) and gives the row number.
Then, you tell Excel to return the value of the cell from the range Phonebook!$A$2:$A$45
and row number obtained from MATCH
.