Spreadsheet Practice

How to keep a running total blank on empty rows in Excel

Formula (Excel and Google Sheets)

=IF(B2="","",SUM($B$2:B2))

Test the row first: =IF(B2="","",SUM($B$2:B2)) shows the running total only where there is a value.

Result on the example
one result per row in C2, filled down to C8
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in C2, filled down to C8. Change any input and the result updates, or edit the formula to experiment.

How it works

A plain running total repeats the last value on every future row, which looks like real data. The IF checks whether the month has a figure: if not, it returns "", an empty-looking cell; if so, it shows the running total. Typing May's donations fills in May's total.

=IF(B2="","",SUM($B$2:B2))

Result4250

  1. B2$4,250

    The value in B2.

  2. B2=""FALSE

    The = operator tests whether the two sides are equal.

  3. $B$2:B2$4,250

    A range: one cell.

  4. SUM($B$2:B2)4250

    SUM: Adds numbers and ranges. Skips text and blanks.

    • number1$B$2:B2$4,250
  5. IF(B2="","",SUM($B$2:B2))4250

    IF: Returns one value if a test is true, another if false.

    • logical_testB2=""FALSE
    • value_if_true""not used
    • value_if_falseSUM($B$2:B2)4250

In Google Sheets

The same formula works in Google Sheets: =IF(B2="","",SUM($B$2:B2)). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=IF(ISBLANK(B2),"",SUM($B$2:B2))$4,250, $8,230, $13,350…ISBLANK reads more clearly, but it treats a formula that returns "" as not blank.

Common mistakes

  • Cells with "" are text, so a chart plots them as 0 in some versions. Use NA() instead of "" if a chart line should stop.
  • Testing the running total instead of the input (IF(SUM($B$2:B2)=0,…)) hides real zero months too.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Keep a running total blank on empty rows

In C2, write a running total of donations that stays empty for months with no figure yet, then fill down to C8.

Questions

How do I do it in one spilling formula?

In Excel 365: =SCAN(0,B2:B8,LAMBDA(a,x,a+x)) gives the totals; wrap it in IF(B2:B8="","",…) to hide empty months.

How do I stop a total showing 0 in an empty row?

Use the same pattern on any formula: =IF(B2="","",your_formula).

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.