Math & Trig
Running balance with debits and credits (checkbook and ledger formula)
Maintain a cumulative bank or ledger balance across separate Deposit and Withdrawal columns while hiding totals on unposted rows.
Why expanding SUM($B$2:B4) - SUM($C$2:C4) beats PreviousRow + B - C
A formula that refers to the preceding balance cell can break if that referenced row is deleted. Expanding sums reduce this dependency by recalculating from transaction amounts.
SUM($B$2:B4) - SUM($C$2:C4) totals deposits less withdrawals through the current row. After inserting, deleting or sorting rows, check the range anchor, opening balance and copied formulas; the calculation is not immune to every structural edit.
| Row | Entry (A) | Deposit (B) | Withdrawal (C) | Running Balance |
|---|---|---|---|---|
| 2 | Opening | 1500 | 0 | 1500 |
| 3 | Client Wire | 850 | 0 | 2350 |
| 4 | Office Rent | 0 | 1200 | 1150 |
| 5 | Unposted | (blank) | (blank) | "" |
Ledger running balance formula with blank-row guard
Wrap in IF(COUNTBLANK(B4:C4)=2, "", ...) so pre-formatted future rows remain blank until a deposit or withdrawal is entered.
=IF(COUNTBLANK(B4:C4)=2, "", SUM($B$2:B4) - SUM($C$2:C4))Reconcile ending balance across entire register
Total deposits minus total withdrawals matches the final posted running balance.
=SUM(B2:B5) - SUM(C2:C5)Inputs and interpretation
Use numeric nonnegative transaction amounts and a deliberate opening-balance entry. Blank or formula-empty rows are hidden, while an entered zero is still a posted value. SUM ignores text amounts, so validate imports. Deposit/withdrawal signs describe this cash register and are not a universal debit/credit convention for all ledger accounts.
Try the example
Use the original values or change them to test your understanding.