Forum Discussion
Pro-Pix
Jun 06, 2023Copper Contributor
Total cost formula with multiple lines
Hi Everyone,
Hoping you can help!
Is there a way I can have a formula calculate the total cost of each of the orders?
For example, In cell "E8" it should equal 333.23
Thanks in advance.
- OliverScheurichGold Contributor
=IF(A2=A3,"",SUMIF($A$2:A2,A2,$D$2:D2))
If you complete the data in column A "Order No." as shown in the screenshot you can try this formula.
- mtarlerSilver Contributor
Pro-Pix I'm slower to respond but recommend you fill in column A because if you (or someone else) ever decides to sort the data or something you can lose the relationship. That said, if this is the output from something else and you can't change that here are a couple options in the attached. I did it both using table reference (which I'm guessing it is NOT a table as sorting would be more likely happen then) and using 'normal' range references:
=IF(OR($A3<>"",$B3=""),SUM(INDEX($D:$D,XMATCH(TRUE,ISNUMBER($A$1:$A2),0,-1)):$D2),"")