Running Total That Resets Each Group

Excel Formulas › Sum

All versionsSUMIFS

A running total that starts over for each customer, project, or month. SUMIFS over the rows up to the current one, filtered to the same group, gives a per-group cumulative sum.


Quick formula: running total within each group (group in A, value in B):
=SUMIFS($B$2:B2, $A$2:A2, A2)
Sum values from the top through this row where the group matches the current row — it resets when the group changes.

Functions used (tap for the full reference guide):

The example

The total restarts at each new group.

ABC
1GroupValueRunning
2X1010
3X515
4Y88

The formula

Cumulative sum within the group:

=SUMIFS($B$2:B2, $A$2:A2, A2) // resets per group

How it works

Expanding ranges plus a group filter:

  1. $B$2:B2 and $A$2:A2 are expanding ranges (absolute start, relative end) covering the rows up to the current one.
  2. SUMIFS(values, groups, A2) adds only the rows whose group matches the current row.
  3. When the group changes, only the new group’s rows so far are summed — so the total resets.
  4. Sort by group (and date) for a meaningful per-group running total.

Running count per group uses the same pattern with COUNTIFS: =COUNTIFS($A$2:A2, A2) numbers the rows 1, 2, 3… within each group — handy for “nth order for this customer.”

Try it: interactive demo

Live demo

Lines “group,value”.

Variations

Running count per group

Nth in group:

=COUNTIFS($A$2:A2, A2)

Running average

Per group:

=AVERAGEIFS($B$2:B2, $A$2:A2, A2)

Group total (all rows)

Final per group:

=SUMIF(A:A, A2, B:B)

Pitfalls & errors

Anchor only the start. $B$2:B2 must have an absolute start and relative end, or it won’t expand row by row.

Sort by group. A scrambled order still sums correctly per group, but the “running” sequence only reads naturally when grouped.

Inserting rows. Expanding-range running totals can shift if you insert rows mid-range — rebuild if the layout changes.

Practice workbook

📊
Download the free Running Total That Resets Each Group practice workbook
A per-group running total with the count, average, and group-total variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I make a running total that resets for each group in Excel?
Use SUMIFS over expanding ranges filtered to the group: =SUMIFS($B$2:B2, $A$2:A2, A2). It sums the group's rows up to the current one and resets at each new group.
How do I number rows within each group?
Use a running count: =COUNTIFS($A$2:A2, A2) gives 1, 2, 3... within each group.
Why doesn't my running total expand?
The range must have an absolute start and relative end, like $B$2:B2. If both ends are fixed it won't grow.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Running total · Running count · SUMIFS multiple criteria

Function references: SUMIFS