Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel find corresponding value, return `0` if not found

I have the formula:

=LOOKUP(C2,'Jul-14'!A:A,'Jul-14'!B:B)

Where:

  • C2 = "Aruba (AW)"

The sheet "Jul-14" doesn't contain the value "Aruba (AW)" in column A. When this happens, it seems to take the closet match and return the value in column B. I need it to return 0 if no exact match is found, or the B column value if an exact match is found.

I've tried changing the function to VLOOKUP and HLOOKUP but it doesn't ever return any value.

like image 816
Tom Gullen Avatar asked Apr 13 '15 10:04

Tom Gullen


People also ask

What does VLOOKUP return if it doesn't find a match?

If the VLOOKUP function does not find an exact match, it will return the #N/A error. By using the IF and ISNA functions, you can return the Unit Price value if an exact match is found. Otherwise, a 0 value is returned. This allows you to perform mathematical operations on your VLOOKUP results.


1 Answers

The following should lookup the value in C2 against the values on the sheet in column A, if it finds a match then it will show it, if it doesn't then it will throw an error which will then return 0

=iferror(vlookup(C2,'Jul-14'!A:B,2,False),0)
like image 84
Shauno_88 Avatar answered Sep 30 '22 12:09

Shauno_88