0
votes

I have to write an Index & Match excel formula, containing multiple criteria!

I have 2 tables: Table

My formula should have the following structure: if Mercedes exists in the first column and Mercedes exists in the fifth column and if the code in the second column matches the code in the sixth column then take the cost from the seventh column and put it in the fourth empty column: enter image description here

If both conditions not met, then insert 0. FORD  15 0

It worked when I used Index & Match with 1 criterion, as seen in the above table:

=(INDEX($G$2:$G$4,MATCH(E2,$A$2:$A$6,0),0))

G is cost column, E2 is value in the second brand column and A is, of course, the first brand column. To add multiple criteria I have tried:

=INDEX(G2:G6,MATCH(1,(A2=A2:A4)*(E2=E2:E4),0))

It does not work! (returns N/A)

Could you please tell me where I am wrong?

Thank you!

1

1 Answers

2
votes

Try matching with a combined formula: (assumes E and F are match terms and A and B are the array to match within, with C providing output)

{=Index(C:C,Match(E1&F1,A:A&B:B,0))}

Use Ctrl+Shift+Enter to utilize the array

enter image description here