Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel: Multiply each cell in row X by corresponding cell in row 2, and get sum

I have a table set up as follows:

Column 1 - Customer Name
Row 1 - Item Name
Row 2 - Item Cost
Row 3+- Item Quantity

How do I set up the last column to calculate the total cost for each customer? I.e, For each customer row, I want to multiply the number in each cell (= quantity) by the corresponding cell in Row 2 (= cost), and add them all up for the final bill.

To clarify what I'm saying I'm attaching the following picture so that we can discuss specifics. enter image description here

like image 356
user2545345 Avatar asked Dec 21 '22 03:12

user2545345


1 Answers

Have you tried SUMPRODUCT - it does exactly what you need, gives the sum of 2 or more multiplied ranges?

=SUMPRODUCT(A71:C71,$A$2:$C$2)

You can extend the ranges as far as you need. If you want to add columns make sure you don't add at the end, e.g. if you retain one blank column (D currently) and include that in the formula, then if you add a column at D the formula will automatically extend to E

like image 71
barry houdini Avatar answered May 03 '23 19:05

barry houdini