"If" statement with Vlookup
Indicatively it should look like this:
=if(isna(vlook1),if(isna(vlook2),if(isna(vlook3)," ",vlook3),vlook2),vlook1)
Here are 2 actual examples, all in one cell (shown indented for clarity):
If you mean lookup the same value (A3) in 3 different sheets:
Sheet2, Sheet3 & Sheet4 (in this sequence):
=IF(ISNA(VLOOKUP(A3,Sheet2!A:B,2,0)),
IF(ISNA(VLOOKUP(A3,Sheet3!A:B,2,0)),
IF(ISNA(VLOOKUP(A3,Sheet4!A:B,2,0)),"",
VLOOKUP(A3,Sheet4!A:B,2,0)),
VLOOKUP(A3,Sheet3!A:B,2,0)),
VLOOKUP(A3,Sheet2!A:B,2,0))
If you mean lookup 3 different values (A3,B3,C3 - in this sequence) in the
same sheet (Sheet2):
=IF(ISNA(VLOOKUP(A3,Sheet2!A:B,2,0)),
IF(ISNA(VLOOKUP(B3,Sheet2!A:B,2,0)),
IF(ISNA(VLOOKUP(C3,Sheet2!A:B,2,0)),"",
VLOOKUP(C3,Sheet2!A:B,2,0)),
VLOOKUP(B3,Sheet2!A:B,2,0)),
VLOOKUP(A3,Sheet2!A:B,2,0))
p/s: For unmatched instances, I'd use blanks: ""
as the return, rather than a space: " "
Above any good? hit the YES below
--
Max
Singapore
xde
---
"Nikki" wrote:
I have three columns that I need to lookup and if the first column is met
then " " for the other two columns. If first column is null then lookup
column B and if B is null lookup column C. A result should show up for only 1
column. I am having difficulty writing the formula without getting errors.
Please help.
|