VLOOKUP() is a curious function.
Consider this table:
Key | Value |
---|---|
1 | David |
2 | John |
3 | Ryan |
To remind you, here is the format: VLOOKUP( searchValue, searchRange, returnColumn )
Everything works fine with the above data table:
VLOOKUP(1, A1:B3, 2) = David
VLOOKUP(2, A1:B3, 2) = John
VLOOKUP(3, A1:B3, 2) = Ryan
Now consider a table like this:
Key | Value |
---|---|
1 | David |
3 | Ryan |
2 | John |
VLOOKUP(1, A1:B3, 2) = David
VLOOKUP(2, A1:B3, 2) = David
VLOOKUP(3, A1:B3, 2) = John
What happened?
VLOOKUP assumes the data is sorted by the key you are searching by!