Running revenue
=SCAN(0, C2:C, LAMBDA(acc, v, acc+v)) cumulative sums sales down the column.
SCAN is like REDUCE but returns every intermediate accumulator in a spilled column. It powers running totals, cumulative text builds, and step-by-step counters without dragging cumulative formulas.
Use SCAN for running balance columns, cumulative revenue, or showing how a fold evolves across a list.
Skip SCAN when you only need the final aggregate. REDUCE or SUM is simpler.
Provide starting accumulator value matching the result type you need.
Pass the array to walk through in order.
Define LAMBDA(acc, value, next_acc) for each step.
SCAN spills one row per array element with the accumulator after each step.
Align output beside source data for chart-friendly running series.
Guard blanks in LAMBDA so running math does not break mid-column.
=SCAN(0, C2:C, LAMBDA(acc, v, acc+v)) cumulative sums sales down the column.
=SCAN(0, B2:B, LAMBDA(acc, v, MAX(acc, v))) tracks peak value seen so far.
=SCAN("", A2:A, LAMBDA(acc, v, acc & v & "; ")) builds a semicolon-separated trail.
Build this without starting from a blank cell
Use a Better Sheets tool for SCAN, then watch a walkthrough when you want the full pattern.
Watch how SCAN works
Guides that explain SCAN in more depth.
Nothing is better than Google Sheets. You just need to learn more about the unlimited power of Google Sheets. Functions, Formulas, Apps Script and more.
Read post →Did you know you can actually code in Google Sheets?
Read post →What you need to know to access Apps Script inside Google Sheets. Code in Google Scripts. Automate business processes and more.
Read post →REDUCE walks an array left to right, carrying an accumulator value updated by a LAMBDA on each step. It can implement custom aggregates, text joins with rules, or conditional running logic that SUM alone cannot express.
Read guide →MAP walks aligned arrays element by element and applies a LAMBDA to each position. Pass one array for unary transforms or several arrays for element-wise combinations. It is the modern replacement for many ARRAYFORMULA column operations.
Read guide →LAMBDA defines an anonymous function inside a formula. You name parameters, write the calculation, then pass arguments when you call it. Combined with MAP, BYROW, or a named LAMBDA in the Name manager, it replaces fragile copy-paste logic across big tables.
Read guide →MAKEARRAY creates a grid of specified height and width, computing each cell with a LAMBDA that receives row and column indexes. It builds lookup tables, sensitivity matrices, and coordinate-driven templates without manual fill.
Read guide →Done reading about SCAN?
Membership unlocks 636+ tutorials, unlimited generators, and every template. Practical lessons. Zero fluff.
Need this once
Jump to a free tool or a single tutorial for this topic.
Learning Sheets for real
Unlock the full library, generators, and templates with membership.