Add Running Total Column
Write a cumulative running total to the column next to your numeric column, in one pass
What it does
You have a column of numbers. You want a running total next to it: row 2 shows the value from row 2, row 3 shows row 2 + row 3, row 4 shows the sum of rows 2-4, and so on. Excel's =SUM($B$2:B2) formula works, but it's a formula that recalculates and depends on cell references staying valid. The macro writes static integers down the column to the right, with a header. No formula maintenance.
Real-world example
Picture a financial analyst at a private school tracking the year-to-date construction spend on the new gym. Each invoice goes in column B with a date in column A. The board wants weekly updates showing both the current invoice amount and the cumulative total since the project started. There are 47 invoices so far this year.
Her current method: drop =SUM($B$2:B2) in C2, fill down 47 rows. The formula works, but it depends on column B's references staying intact. Last month someone deleted a row of column A by accident; the SUMs all shifted and showed wrong totals for two weeks before anyone noticed.
With this macro she selects column B, runs the tool, and 47 running totals appear in column C as static numbers in 1 second. The popup confirms the count. The header Running Total lands in row 1 with bold formatting. The values don't depend on formula references, so a row deletion in column A doesn't silently corrupt them; it just removes that row's running total entry.
On a 47-invoice tracker, the time saved per pass is small but the correctness improvement is meaningful: static values can't be silently broken by a row delete elsewhere.
How to use
First time? See How to run our tools for the 30-second setup.
- Select the single column of numbers (include the header row).
- Press Alt + F8 (Windows) or Option + F8 (Mac), pick
AddRunningTotalColumn, click Run. - The macro writes a
Running Totalheader in row 1 of the column to the right, then fills the running total for each numeric row. Popup reports the count.
FAQ
What about non-numeric cells in the column?
They don't increment the running total and don't get a value written in the destination column. So if row 5 is text like Subtotal: refer to summary, row 5 has nothing in the running total column, and row 6's running total picks up where row 4 left off.
Why static values instead of formulas?
Formulas recalculate, which means deleting or inserting rows above the formula changes the displayed numbers. For a running total, that's the wrong behavior: the running total at row 47 should always reflect the sum of rows 2-47 as they were at the time of calculation, not as they are after a structural change. Static values don't shift.
What if I want a recalculating running total instead?
Use the formula =SUM($B$2:B2) directly. This macro is for the static case. For recalculating: type the formula in C2, fill down. We may add a "static or formula" option in a future macro version.
Does it overwrite existing data in the destination column?
Yes. The macro writes to the column directly to the right of your selection. If that column has data, it gets overwritten. Insert a blank column first if needed.
Can I undo it?
Yes, Ctrl/Cmd + Z right after running undoes the writes. Source data is untouched, so undo is clean.
What to do next
After adding the running total, if you want a totals row at the bottom too, run Add Totals Row to Numeric Columns. The two pair well: running total down the column, total at the bottom.
Did this tool work for you?
One click. We use this to fix tools that don't work and prioritize what to build next.
Related tools
Add Totals Row to Numeric Columns
Drop a SUM formula at the bottom of every numeric column in your selection, plus a 'Total' label and a top border
Auto Pivot Summary
One-click summary of any data: group by one column and sum another, output to a new Summary sheet
Compare Two Columns
Highlight every cell in two columns whose value does not appear in the other column, in one click.