Tom Gullen
Tom Gullen

Reputation: 61725

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

I have the formula:

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

Where:

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.

Upvotes: 5

Views: 19375

Answers (1)

Shauno_88
Shauno_88

Reputation: 665

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)

Upvotes: 12

Related Questions