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).