Reputation: 3
How would I sum vertically the columns that meet a given criteria?
For example:
A B C D E F G
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
If criteria = A, then the formula would give me 4 if B, 8 if C, 12. I would like the criteria input to be a reference-able cell.
Thanks for your help!
Upvotes: 0
Views: 52
Reputation: 638
Assuming you have a sheet like this:
=SUM(INDEX($BF$5:$BI$16,,Match($BC$5,$BF$4:$BI$4,0)))
Upvotes: 0
Reputation: 152660
Use INDEX to return the correct array. Use MATCH to return the correct column:
=SUM(INDEX(2:5,0,MATCH(J1,1:1,0)))
Upvotes: 1