Each calculation represents the sum of values up to that point.

In this example, each calculation takes into account another month of the year.

There are several ways to approach this problem, as explained below.

Running total with SUM function and two values

The result is a cumulative sum of the values in column C up to that point.

Note: formulas with expanding ranges can cause performance problems in large sets of data.

The formula below is more efficient.

Running total with SUM function and two values

The reason we use theSUM functionin this formula, instead of simple addition, is that SUM willautomaticallyignoretext values.

If we try instead to write a formula like this:

The result is a #VALUE!

SCAN can be used to generate running totals and other calculations that show intermediate or incremental results.

Running total with SUM function and two values

The SCAN function uses theLAMBDA functionto apply the logic needed.

If so, we return a+v.

If v is empty, we return anempty string("").

Running total with SUM function and two values

This makes it possible to use SCAN in more powerfulall-in-one formulas.

Pivot Table

APivot Tableis another good way to calculate running totals.

See abasic example here.

Running total with SUM function and two values

These values can be numbers, cell references, ranges, arrays, and constants, in any combination.

SUM can handle up to 255 individual arguments.

Calculate running total with the SCAN function

Excel formula: Running count of occurrence in list

Excel formula: Running total in Table

Excel SUM function

Excel SCAN function

Article image

Article image