VLOOKUP Condition

L

lightbulb

I'm trying to do a Vlookup where if it can't find the information in the
specified array, it returns a predetermined value...is there a way to do this?

Thanks!
 
J

JLatham

Yes, when VLookup() doesn't find a match, it returns #N/A error and you can
test for that:

=IF(ISNA(yourVlookupFormula),predeterminedValue,yourVlookupFormula)

a real one might look like
=IF(ISNA(VLOOKUP(A1,Sheet2!B9:X109,3,False)),-55,VLOOKUP(A1,Sheet2!B9:X109,3,False))

You could even return text as:
=IF(ISNA(VLOOKUP(A1,Sheet2!B9:X109,3,False)),"No Match
Found",VLOOKUP(A1,Sheet2!B9:X109,3,False))
 
M

Mike H

hi,

2 ways

=IF(COUNTIF(A1:A20,F1)>0,VLOOKUP(F1,A1:B20,2,FALSE),"My Pre defined value")

or

=IF(ISNA(VLOOKUP(F1,A1:B20,2,FALSE)),"My pre defined
value",VLOOKUP(F1,A1:B20,2,FALSE))

Mike
 
Top