Sum Up Amount when Invoice Changes

DShack

Board Regular
Joined
Jan 15, 2014
Messages
64
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I am trying to write a formula that would sum up the total amounts based on the invoice id changing (see table below). I additionally, have a quantity that needs to be multiplied by the amount and then sum the total. The Invoice ID does not copy down so it needs to change when it finds the next Invoice ID to calculate again.

*Invoice IDLine Number*Line Type*AmountInvoice Quantity
1001​
1​
ITEM
500.00​
2​
2​
ITEM
300.00​
3​
1002​
1​
ITEM
250.00​
4​
2​
ITEM
300.00​
5​
3​
ITEM
100.00​
6​
1003​
1​
ITEM
100.00​
4​
2​
ITEM
200.00​
1​
3​
ITEM
300.00​
2​
4​
ITEM
400.00​
6​
1004​
1​
ITEM
100.00​
2​
2​
ITEM
200.00​
1​
3​
ITEM
300.00​
6​
4​
ITEM
400.00​
4​
5​
ITEM
500.00​
2​
1005​
1​
ITEM
1000.00​
1​
1006​
1​
ITEM
100.00​
3​
2​
ITEM
100.00​
5​
1007​
1​
ITEM
200.00​
4​
2​
ITEM
300.00​
3​
3​
ITEM
400.00​
2​
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Maybe you could use this;

Book1
ABCDEFGH
1*Invoice IDLine Number*Line Type*AmountInvoice QuantityInvoice TotalInvoice ID Fill DownInvoice Total
210011ITEM$500.002$1,000.001001 
32ITEM$300.003$900.001001$1,900.00
410021ITEM$250.004$1,000.001002
52ITEM$300.005$1,500.001002
63ITEM$100.006$600.001002$3,100.00
710031ITEM$100.004$400.001003
82ITEM$200.001$200.001003
93ITEM$300.002$600.001003
104ITEM$400.006$2,400.001003$3,600.00
1110041ITEM$100.002$200.001004
122ITEM$200.001$200.001004
133ITEM$300.006$1,800.001004
144ITEM$400.004$1,600.001004
155ITEM$500.002$1,000.001004$4,800.00
1610051ITEM$1,000.001$1,000.001005$1,000.00
1710061ITEM$100.003$300.001006
182ITEM$100.005$500.001006$800.00
1910071ITEM$200.004$800.001007
202ITEM$300.003$900.001007
213ITEM$400.002$800.001007$2,500.00
Sheet1
Cell Formulas
RangeFormula
F2F2=E2*D2
G2G2=IF(A2<>"",A2,G1)
H2H2=IF(B2=MAXIFS($B$2:$B$21,$G$2:$G$21,G2),SUMIFS($F$2:$F$21,$G$2:$G$21,G2),"")
 
Upvote 0
It is always a good idea to include your expected results so that we know what they are and where they are.
I am not sure if you are looking for those intermediate columns that @RasGhul has included?
If not and you just want the invoice totals, then perhaps this?

21 08 25.xlsm
ABCDEF
1*Invoice IDLine Number*Line Type*AmountInvoice QuantityInvoice Total
210011ITEM5002 
32ITEM30031900
410021ITEM2504 
52ITEM3005 
63ITEM10063100
710031ITEM1004 
82ITEM2001 
93ITEM3002 
104ITEM40063600
1110041ITEM1002 
122ITEM2001 
133ITEM3006 
144ITEM4004 
155ITEM50024800
1610051ITEM100011000
1710061ITEM1003 
182ITEM1005800
1910071ITEM2004 
202ITEM3003 
213ITEM40022500
22
Inv Totals
Cell Formulas
RangeFormula
F2:F21F2=IF(OR(A3<>"",E3="",""),SUMPRODUCT(D$2:D2,E$2:E2)-SUM(F$1:F1),"")
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,243
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top