nested if

J

Janis

This vlookup works for the sheet its on, but if it doesn't find it I want it
to check the weekending for the 2 previous sheets respectively.

=VLOOKUP(B46,'07-17-07'!B45:I112,8,FALSE)
What I want to know is will this work to nest the if's.
if(=VLOOKUP(B46,'07-17-07'!B45:I112,8,FALSE),=VLOOKUP(B46,'07-10-07'!B45:I112,8,FALSE),=VLOOKUP(B46,'07-3-07'!B45:I112,8,FALSE))

tia,
 
P

Pete_UK

You really need a construct like this:

=IF(ISNA(vlookup_1),IF(ISNA(vlookup_2),IF(ISNA(vlookup_3),"not
present",vlookup_3),vlookup_2),vlookup_1)

So, your formula would be:

=IF(ISNA(VLOOKUP(B46,'07-17-07'!
B45:I112,8,0)),IF(ISNA(VLOOKUP(B46,'07-10-07'!B45:I1­
12,8,0)),IF(ISNA(VLOOKUP(B46,'07-3-07'!B45:I112,8,0)),"not
present",VLOOKUP(B46,'07-3-07'!B45:I112,8,0)),VLOOKUP(B46,'07-10-07'!
B45:I1­12,8,0)),VLOOKUP(B46,'07-17-07'!B45:I112,8,0))

I've replaced FALSE with 0 to make it a bit shorter, but this is all
one formula so be wary of spurious linebreaks if copy/pasting from the
newsgroups.

Hope this helps.

Pete
 
H

Harlan Grove

Janis said:
This vlookup works for the sheet its on, but if it doesn't find it I
want it to check the weekending for the 2 previous sheets respectively. ....
What I want to know is will this work to nest the if's.

if(=VLOOKUP(B46,'07-17-07'!B45:I112,8,FALSE),
=VLOOKUP(B46,'07-10-07'!B45:I112,8,FALSE),
=VLOOKUP(B46,'07-3-07'!B45:I112,8,FALSE))

You'd need something like

=IF(1-ISNA(VLOOKUP(B46,'07-17-07'!B45:I112,8,0)),
VLOOKUP(B46,'07-17-07'!B45:I112,8,0),
IF(1-ISNA(VLOOKUP(B46,'07-10-07'!B45:I112,8,0)),
VLOOKUP(B46,'07-10-07'!B45:I112,8,0),
IF(1-ISNA(VLOOKUP(B46,'07-3-07'!B45:I112,8,0)),
VLOOKUP(B46,'07-3-07'!B45:I112,8,0),"")))
 
J

JE McGimpsey

One way:

=IF(ISNA(MATCH(B46,'07-17-07'!B45:B112, FALSE)),
IF(ISNA(MATCH(B46,'07-10-07'!B45:B112, FALSE)),
VLOOKUP(B46,'07-03-07'!B45:I112, 8, FALSE),
VLOOKUP(B46,'07-10-07'!B45:I112, 8, FALSE)),
VLOOKUP(B46,'07-17-07'!B45:I112,8,FALSE))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top