Running Total Formula

A running total, also called a cumulative sum, shows the total up to and including each row. The trick is a range that is locked at the top and open at the bottom, so it grows as you fill the formula down.

Free, no sign-up required · 5 free generations a day

Last updated

Describe your task, get the formula

Type what you need in plain English, or pick an example below. You get the formula, a step-by-step explanation, and a worked example.

Running total formulas

Syntax
=SUM($B$2:B2)
=SUMIF($A$2:A2, A2, $B$2:B2)
=SUBTOTAL(109, $B$2:B2)

The dollar signs lock the start of the range at B2 while the end reference B2 moves down as you fill. The second version restarts the total for each category, and the third ignores rows hidden by a filter.

Examples

Basic running total

=SUM($B$2:B2)

In row 2 it adds B2, in row 3 it adds B2:B3, and so on. Enter it in the first data row and fill down.

Running total per category

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

Adds only the rows up to this one whose category in column A matches the current row, so each category builds its own cumulative total. The data does not need to be sorted.

Running total that ignores filtered rows

=SUBTOTAL(109,$B$2:B2)

Function number 109 is SUM that skips hidden rows, so the total updates when you filter the table.

Common mistakes and how to fix them

Every row shows the same total

The whole range is locked, for example $B$2:$B$2. Only the start of the range gets dollar signs: $B$2:B2.

The total breaks after sorting

A running total depends on row order, so sort the data first and then fill the formula down again, or use a table so formulas fill automatically.

The total includes filtered-out rows

SUM always counts hidden rows. Use SUBTOTAL(109,...) when the table will be filtered.

Frequently asked questions

Is there a way without an expanding range?

Yes: in the first data row use =B2, and in the second row use =C2+B3 and fill down, where column C holds the running total. It is simple but breaks more easily if a row is deleted.

How do I restart the total each month?

Use a helper column with the month, for example =TEXT(A2,"yyyy-mm"), and apply the per-category SUMIF version to that column.

Does it work in Google Sheets?

Yes. SUM, SUMIF, and SUBTOTAL work the same in Google Sheets.

Don't want to write it by hand?

Describe what you need in plain English and get a ready-to-use formula in seconds.

Try the formula generator