Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

How to fix VLOOKUP when it returns the incorrect value from the bottom of the list?

$
0
0

In Google Sheets, I am having trouble with a VLOOKUP function.

  • range argument A2:B contains text strings.
  • search_key is in column C, example, C2
  • index argument is (column) 2, which is equivalent to B2:B

Current Formula

  • I thought my syntax was correct, but my VLOOKUP formula returns the wrong value.
  • In column A are the textual search keys and in column B are the values that I wish to return. Values are sorted.
  • Note that #value! in IFNA is intentional. I want to use the results in a TOCOL function and it was not treating "" as a blank ("ignore blanks") so I replaced "" with #value! and used "ignore error" instead.
=ifna(vlookup($C2,$A$2:$B,2),#value!)

Sample Data

  • B2:B strings are actually 50 characters in length (not 10); they've been shortened below to save space
ABCDE
1search_keylist of valuesuser_inputcurrent formuladesired result
2mm1101000000mm01000000001101000000
31100000000#VALUE!
4mn1100001000mn01000000001100001000
51100000010#VALUE!
6ʙʛ0100000000#VALUE!

Link to Test Spreadsheet illustrating problem


Viewing all articles
Browse latest Browse all 9782

Trending Articles