I have a sample data B3:G6 as shown. the data is categorized into Metals, Polymers, Elastomers and here I have assigned Names for each category. In column J I have several materials which belong to either of these categories of metals, polymers or elastomers. to extract the percentage of respective material, I have used the following formula in column K, which works as desired.
=IF((ISNUMBER(MATCH($J3;Metals;0))=TRUE);VLOOKUP($J3;$B:$C;2);IF((ISNUMBER(MATCH($J3;Polymers;0))=TRUE);VLOOKUP($J3;$D:$E;2);IF((ISNUMBER(MATCH($J3;Elastomers;0))=TRUE);VLOOKUP($J3;$F:$G;2);"")))
Is it possible to simplify this formula? because if my searching category increases for some reason leading to additional columns, the nested IF becomes much more longer.
Use SUMIFS with offset ranges:
=SUMIFS($C$3:$G$6,$B$3:$F$6,J3)