“Use of more then 7 nested if statementâ€

F

Faisal Yameen

I used if statement in the form of
=IF(B37=B2,C37,IF(B38=B2,C38,IF(B39=B2,C39,IF(B40=B2,C40,IF(B41=B2,C41,
IF(B42=B2,C42,IF(B43=B2,C43,IF(B44=B2,C44,"Un Known"))))))))
(It means if cell B2 is equal to B37 then print C37 and if cell B2 is equal
to B38 then print C38 and respectively others)
(I used this formula in cell C2)
Here I used only 7 nested if statement. But now I want to use more then it
nearly 500 nested if statement.
Please help me and guide me about this problem
Thanks.
 
B

Bernie Deitrick

Faisal,

In C2, use the formula:

=VLOOKUP(B2,B37:C2000,2,FALSE)

HTH,
Bernie
MS Excel MVP
 
B

Bernie Deitrick

Faisal,

Sorry, forgot about the not found part:

=IF(ISERROR(VLOOKUP(B2,B37:C2000,2,FALSE)),
"UnKnown",VLOOKUP(B2,B37:C2000,2,FALSE))

All on one line....

HTH,
Bernie
MS Excel MVP
 
Top