What formulas can I use for cumulative calculations in Numbers?

I am trying to get help figuring out a good formula to add the Cumulative column for each date, as in, adding up to row 11 and starting over at row 12 to add up to 18. I used IF in this table for all Jan 2 but I believe I need to use SUMIFS along with ">="& "<="&. Is there a way to do this?





[Re-Titled by Moderator]

Mac mini, macOS 14.6

Posted on Mar 4, 2025 7:34 PM

Reply
7 replies
Sort By: 

Mar 6, 2025 6:21 PM in response to Nmbrs_user25

There are several formula-based ways to do it. Here are three and how they fair under different situations.


R2 =IF(D2=D1,SUM(Q2,R1),Q2)

Fill down

Used SUM rather than + in the formula so that it would work in row 2. The SUM formula ignores text.

  • Adding a row in the middle: You will have to fix the column of formulas to include the new row
  • Deleting a row: It will cause an error and miscalculations. You will have to fix the column of formulas
  • Moving a row manually: You will have to fix the column of formulas
  • If a date is out of place (like there is a 1/3/24 in the middle of the 1/2/24's): the cumulative will restart.
  • Sorting: I think sorting will be okay with this formula

------


R2 = SUMIF(D$2:D2,D2,Q$2:Q2)

Fill down

  • Adding a row in the middle: No problem
  • Deleting a row: No problem
  • Moving a row manually: You will have to fix the column of formulas
  • If a date is out of place (like there is a 1/3/24 in the middle of the 1/2/24's): The formula will give you a cumulative number for this row that will be part of the cumulative for its date. It will just be out of place in your table.
  • Sorting: do not sort the table. Numbers has a very long standing bug about sorting formulas that have references like D$2:D2 where the first part is locked to a row and the second is not. It creates reference errors.

------


Make a new column (say it is column S)

S2 = ROW()

R2 =SUMIFS(Q,D,D2,S,"<="&S)

Fill down with both formulas

It requires that extra column, which is a downside.

  • Adding a row in the middle: No problem
  • Deleting a row: No problem
  • Moving a row manually: No problem
  • If a date is out of place (like there is a 1/3/24 in the middle of the 1/2/24's): The formula will give you a cumulative number for this row that will be part of the cumulative for its date. It will just be out of place in your table.
  • Sorting: No problem

----


For the most trouble-free result, the third formula is best but the others will work as long as you know their limitations.


Make sure your dates in column D are actually just the date (at 12:00AM). None of these formulas will work correctly if any of the dates have a time associated with them (other than the default 12:00AM).






Reply

Mar 5, 2025 12:07 PM in response to Nmbrs_user25

Have you considered a Pivot Table? They're designed for summarizing data like this.


It's three clicks to get you what you want. Select your table, then:


Organize -> Create Pivot Table

In the Inspector, drag Sales Date to the Rows field

Drag Net Sales to the Values field.


Done:



If you really want a cumulative running total then set R2 to:


=Q2


(since the first cumulative total is the same as the first sale on the first day)


Then set R3 to:


=IF(D3=C3, R2+Q3, Q3)


Fill down.


Breaking down that formula, it checks to see if the Date of this row (D3) is the same as the date in the preceding row (C3). If it is, then it adds the previous cumulative total and the current row's net sales value. If the dates don't match then it assumes a new day and simply copies the first sale of the day (note this works on the days being consecutive and not out of order)


The main issue I see with doing it this way is the lack of visual cue as to when the day changes, but it's your preference.

Reply

Mar 4, 2025 11:10 PM in response to Nmbrs_user25

The first two very simple solutions that come to mind are:


A subtotal at the bottom of column C and with the quick filter choosing the number of the day. This way you can see the sums day by day.


=SUBTOTAL(9;Net Sales Amount)


Or using a sum.if in E2 that you then drag down


=SUMIF(Units Sold;RIGA($B1);Net Sales Amount)


Reply

What formulas can I use for cumulative calculations in Numbers?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.