Cumulative monthly total

Muthukrishnan V

Active Member
Joined
May 29, 2008
Messages
280
Office Version
  1. 365
Platform
  1. Windows
Excel 2007

Column A contain dates chronologically from
01-01-2020 to 31-03-2020 for 3 months
in dd-mm-yyyy format.

Column B in numerical. On daily basis expenses
for the particular dates are entered

Column C in numerical. Calculates cumulative
total expenses.

My request: Column C should start afresh every
month.
For example upto 31-01-2020,
total cumulative expenses 80000. On
01-02-2020 (Feb Begins); Col B expenses
that day is 1500. Now Col C cumulative
total shows 81500.

Here, I want Col C to show 1500 (being
cumulative total for Feb.

Request formula. Thanking you,
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try:
Copy formula down as needed.

Book1
ABC
1DateExpenseCum Total
21/1/202011
31/2/202023
41/3/202036
51/4/2020410
61/5/2020515
71/6/2020621
81/31/2020728
92/1/202088
102/2/2020917
112/5/20201027
123/2/20201111
133/3/2020112
Sheet3
Cell Formulas
RangeFormula
C2:C13C2=SUMPRODUCT(--(MONTH($A$2:A2)=MONTH(A2)),($B$2:B2))
 
Upvote 0
Another way

A_MrExcel.xlsm
ABC
1DateExpenseCum Total
21/01/202011
32/01/202023
43/01/202036
54/01/2020410
65/01/2020515
76/01/2020621
831/01/2020728
91/02/202088
102/02/2020917
115/02/20201027
122/03/20201111
133/03/2020112
Monthly cumulative
Cell Formulas
RangeFormula
C2:C13C2=IF(TEXT(A2,"m")=TEXT(A1,"m"),C1+B2,B2)
 
Upvote 0
Power Query isn't the better solution in this case. It's a lot more convoluted, but it was a fun exercise.

Book1
ABCDEF
1DateExpenseDateExpenseRunning Total
21/1/202011/1/202011
31/2/202021/2/202023
41/3/202031/3/202036
51/4/202041/4/2020410
61/5/202051/5/2020515
71/6/202061/6/2020621
81/31/2020728
92/1/202088
102/2/2020917
112/5/20201027
123/2/20201111
133/3/2020112
Sheet8


Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table5"]}[Content],
    Type = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Expense", Int64.Type}, {"Cum Total", Int64.Type}}),
    Month = Table.AddColumn(Type, "Month", each Date.MonthName([Date])),
    Group = Table.Group(Month, {"Month"}, {{"group", each _, type table [Date=date, Expense=number, Cum Total=number, Month=text]}}),
    addIndex = Table.TransformColumns(Group,{"group",each Table.AddIndexColumn(_,"Custom",1)}),
    runningTotal = Table.TransformColumns(addIndex,{"group",(tbl)=> Table.AddColumn(tbl,"Running Total",each
        List.Sum(List.Range(tbl[Expense],0,[Custom]))
        )}),
    Rxpand = Table.ExpandTableColumn(runningTotal, "group", {"Date", "Expense", "Running Total"}, {"Date", "Expense", "Running Total"}),
    RC = Table.RemoveColumns(Rxpand,{"Month"})
in
    RC
 
Upvote 0
Excel 2007

With Solution with sumproduct formula, it works

fine. But I observe that as of now (today being 27-02-2020,

dd-mm-yyyy), there are entries in Column B (daily entries)

and column C shows correct cumulative balances. There

are no entries in future dates, i.e. from 28-02-2020 to

31-02-2020. From 28-02-2020 Column C shows balances.

27-02-2020 Cumulative balance is 157900 and this is

appearing for future dates 28-02-2020 to 29-02-2020.

My request: Kindly give me an amended formula so that

Column C shows blank for future dates.
 
Upvote 0
Using SUMPRODUCT formula try:

Book1
ABC
1DateExpenseCum Total
21/1/202011
31/2/202023
41/3/202036
51/4/2020410
61/5/2020515
71/6/2020621
81/31/2020728
92/1/202088
102/2/2020917
112/5/20201027
123/2/202011 
133/3/20201 
Sheet1
Cell Formulas
RangeFormula
C2:C13C2=IF(A2>TODAY(),"",SUMPRODUCT(--(MONTH($A$2:A2)=MONTH(A2)),($B$2:B2)))
 
Upvote 0
Using IF formula, try

20 02 27.xlsm
ABC
1DateExpenseCum Total
201-Jan-2011
302-Jan-2023
403-Jan-2036
504-Jan-20410
605-Jan-20515
706-Jan-20621
831-Jan-20728
901-Feb-2088
1002-Feb-20917
1105-Feb-201027
1202-Mar-2011 
1303-Mar-201 
Cum Total
Cell Formulas
RangeFormula
C2:C13C2=IF(A2>TODAY(),"",B2+IF(TEXT(A2,"m")=TEXT(A1,"m"),C1,0))
 
Upvote 0
Excel 2007.

Thank you Sirs, for your kind and valuable help. I have

one more question to ask. To arrive at average expenses

based on cumulative balance, in Column D2, I have

entered formula =IF(COUNT(B2:C2),AVERAGE($B$1:$B2),"")

and carried this upto D95. Cell B1 is blank.


This gives average of the cumulative expenses alright, but

reckons from 01-01-2020. How to amend this formula so that

the average is for particular months. Thank you,
 
Upvote 0

Forum statistics

Threads
1,215,635
Messages
6,125,945
Members
449,275
Latest member
jacob_mcbride

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