Adding window functions to a spreadsheet

By Dmitry Sagalovskiy, Co-founder and Head of Product at Grist, October 28, 2026

Running totals, cumulative balances, and nearest matches: formulas between rows that stay correct.

Here is a formula many of us wrote early on. Put transactions in a traditional spreadsheet, like Excel or Google Sheets, one per row, and keep a running balance:

Google Docs screenshot showing a basic running balance formula: =C3+B4

Copy the formula down, and it works. Each balance is the balance above it plus the amount on its own row.

Now you find a receipt from January 11 and insert a row for it, between rows 3 and 4. The new row has no formula, so you type one in, or copy it from above. But the balance below it now says =C3+B5. When the rows shifted, the reference was adjusted to keep pointing at the same cell, and that cell is no longer the row above. The new transaction is skipped without showing an error of any kind. The balance is just wrong from that row on.