theshizy
theshizy

Reputation: 545

Add IF statement to VLOOKUP

How would I add an IF statement to a VLOOKUP, so that the value returned is not found (i.e. 0, then instead of writing 0 it writes "John Owen"?

Code so far:

=VLOOKUP(E:E,Master!A:I,9)

Upvotes: 0

Views: 860

Answers (2)

bf2020
bf2020

Reputation: 732

As Steve Martin wrote, make sure to include FALSE in the 4th argument of the VLOOKUP function, but here is another version of that equation that returns the VLOOKUP value unless there is an error or zero:

=if(not(iserror(vlookup(E:E,MASTER!A:I,9,False))),if(vlookup(E:E,MASTER!A:I,9,False)=0,"John Owen",vlookup(E:E,MASTER!A:I,9,False)),"John Owen")

Upvotes: 1

Steven Martin
Steven Martin

Reputation: 3290

VLOOKUP doesnt return 0 if a lookup is not found, it returns #N/A

If you are receiving a 0 , its because the lookup is found but the return column is blank

also make sure to include False in the VLOOKUP so that an exact match is needed.

=IFERROR(VLOOKUP(E:E,Master!A:I,9,False),"John Owen")

Upvotes: 1

Related Questions