Building a running cash balance or a cumulative sales total in Excel usually means writing a formula like =C8+B9 and dragging it down every time you add a new month. With SCAN in Excel and its summary partner REDUCE, you can loop through an entire range using a single LAMBDA formula—returning either every intermediate step (with SCAN) or just the final accumulated value (with REDUCE).
Availability & Compatibility: Per the official SCAN function documentation and REDUCE function documentation, SCAN is available in Excel for Microsoft 365 (Windows and Mac), Excel for the web, and Excel 2024, while REDUCE is available in Excel for Microsoft 365 and Excel for the web (both also work in Google Sheets). Older perpetual releases such as Excel 2021 and Excel 2019 do not support either function and will display #NAME?.
Table of Contents
How SCAN in Excel Works (Dynamic Running Totals)
SCAN walks through an array one cell at a time, updates an accumulator variable on each step using your LAMBDA function in Excel, and spills an array containing every intermediate value. Here is the syntax:
=SCAN([initial_value], array, LAMBDA(accumulator, value, body))
- [initial_value] (Optional): The starting value for the accumulator before the first element is processed. Set this to
0for sums,1for multiplication, or""when concatenating text. - array (Required): The range or dynamic array to scan from top-left to bottom-right.
- lambda (Required): A two-parameter
LAMBDA(a, v, body)whereaholds the running accumulator andvholds the current cell value.
Suppose your Practice sheet tracks H1 2026 monthly net cash flows in B6:B11, with a starting cash balance of $10,000 in cell D4. To spill all six monthly running balances from one cell in D6, enter:
=SCAN(D4, B6:B11, LAMBDA(a, v, a+v))
Excel starts a at $10,000, adds January’s $3,200 to spill $13,200, subtracts February’s -$1,450 to spill $11,750, and continues automatically through June ($23,000)—no dragged formulas required.
How REDUCE Works (Return Only the Final Accumulated Value)
REDUCE uses the exact same three arguments as SCAN, except instead of spilling every intermediate step, it returns only the final value stored in the accumulator:
=REDUCE([initial_value], array, LAMBDA(accumulator, value, body))
Think of REDUCE as a custom, conditional aggregator when built-in functions like SUMIF or PRODUCT fall short. For example, to sum only positive cash inflows in B6:B11 starting from 0:
=REDUCE(0, B6:B11, LAMBDA(a, v, IF(v>0, a+v, a)))
This returns $15,350 as a single scalar value. If you ever need row-by-row or column-by-column summaries across a 2D table instead of sequential accumulation, pair these techniques with BYROW and BYCOL in Excel.
SCAN vs. REDUCE vs. Classic Running-Total Formulas
Use this comparison table to pick the right accumulator approach for your workbook:
| Method | Output Shape | Supports Resets / Conditions? | Compatibility | Best For |
|---|---|---|---|---|
| SCAN | Full spilled array (every step) | Yes (via IF inside LAMBDA) | M365, Excel 2024, Sheets | Running balances, streak counters |
| REDUCE | Single final value | Yes (via IF inside LAMBDA) | M365, Excel for web, Sheets | Conditional products, custom totals |
| Dragged =C8+B9 | 1 cell per copy | Manual edits required | All Excel versions | Legacy Excel 2021/2019 sharing |
Troubleshooting #VALUE!, Initial-Value Bugs, and #SPILL! Errors
- #VALUE! error (“Incorrect Parameters”): Per Microsoft Support,
SCANandREDUCErequire aLAMBDAwith exactly two parameters (accumulatorandvalue). Passing one or three parameters triggers#VALUE!. - Multiplication always returns 0: If you omit
initial_valueor pass0when multiplying insideREDUCEorSCAN, every step multiplies by zero. Always setinitial_valueto1for products and""for text strings. - #SPILL! error with SCAN: Clear any existing values or merged cells below the formula cell—see our guide on how to fix the #SPILL! error in Excel.
- #NAME? error: The workbook was opened in Excel 2021 or older, where
SCANandREDUCEare unavailable.
Frequently Asked Questions
Download the practice workbook
The same data as this tutorial, with empty answer cells and a Solutions sheet.