Search code examples
excelnestedvlookuplookupsumproduct

V-Lookup across multiple arrays


I am having trouble using lookup functions to achieve the following.

From Table-1, I need to look-up the Items list, and depending on what type of item it is (Fruit/Veg/Seed), pull in the corresponding percentage to Table-2. I have tried to so this using Vlookup and nested IFs but its not working.

enter image description here

=IF((VLOOKUP($A$10:$A$16,$A$1:$E$8,2,FALSE)=$B$9),$C$1:$C$8,IF((VLOOKUP($A$10:$A$16,$A$1:$E$8,4,FALSE)= $E$1:$E$8,""))

Solution

  • You need to do two VLOOKUP's. The first for Cat-1, and the second for Cat-2:

    =IF(VLOOKUP($B13,$B$4:$F$10,2,FALSE)=C$12,VLOOKUP($B13,$B$4:$F$10,3,FALSE),
    IF(VLOOKUP($B13,$B$4:$F$10,4,FALSE)=C$12,VLOOKUP($B13,$B$4:$F$10,5,FALSE),""))
    

    Enter in C13 and fill across and down.

    The second VLOOKUP is entered into the value_if_false portion of the first IF.

    enter image description here