Reputation: 647
I have a spreadsheet that looks like this.
In this example, I calculated the Totals with something by manually multiplying the unit counts (B2:E4) with the costs (B7:B10) of the appropriate product and summing each row.
My actual datais too complicated to do this manually. What I would like to do is have a formula to automatically generate the Total column. I imagine this is some magic combination of SUM, VLOOKUP & Array Formulas, but I've failed to find the solution.
Here is the sample in spreadsheet form if that helps.
Thanks.
Upvotes: 0
Views: 96
Reputation: 152585
You can combine a lookup with SUMPRODUCT:
=SUMPRODUCT((LOOKUP($B$1:$E$1,$A$7:$A$10,$B$7:$B$10))*B2:E2)
If the cost were in row 2 a simple SUMPRODUCT would suffice:
=SUMPRODUCT($B$2:$E$2,B3:E3)
Upvotes: 2