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

15,895

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)
Share:
15,895
Tom Gullen
Author by

Tom Gullen

Me Web developer. Website http://www.scirra.com

Updated on June 11, 2022

Comments

  • Tom Gullen
    Tom Gullen almost 2 years

    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.