View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default Conditional Vlookup

Biff wrote...
....
=IF(ISNUMBER(MATCH(AD2,{"B10x5x5","B10x10x5"},0)) ,
VLOOKUP(AP2,INDIRECT(AD2),2),"Your Choice")

....

You could shorten the test.

=IF(OR(AD2={"B10x5x5","B10x10x5"}),
VLOOKUP(AP2,INDIRECT(AD2),2),"Your Choice")

If there were a lot of ranges to choose from and their names were
listed in another range named List, you could use another range,
perhaps named Trap, to handle no match found. The formula above could
be replaced by

=VLOOKUP(AP2,INDIRECT(IF(COUNT(MATCH(AD2,List,0)), AD2,"Trap")),2)

and Trap would be 1 row by 2 columns with the first column containing
the formula =AP2 and the second column containing the string Your
Choice.