What is SCAN in Google Sheets?

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.

When to use it

Use SCAN for running balance columns, cumulative revenue, or showing how a fold evolves across a list.

When to skip it

Skip SCAN when you only need the final aggregate. REDUCE or SUM is simpler.

How it works

  1. 1

    Provide starting accumulator value matching the result type you need.

  2. 2

    Pass the array to walk through in order.

  3. 3

    Define LAMBDA(acc, value, next_acc) for each step.

  4. 4

    SCAN spills one row per array element with the accumulator after each step.

  5. 5

    Align output beside source data for chart-friendly running series.

  6. 6

    Guard blanks in LAMBDA so running math does not break mid-column.

Examples in Google Sheets

Running revenue

=SCAN(0, C2:C, LAMBDA(acc, v, acc+v)) cumulative sums sales down the column.

Running max

=SCAN(0, B2:B, LAMBDA(acc, v, MAX(acc, v))) tracks peak value seen so far.

Growing text log

=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.

Better Sheets resources

Common mistakes

  • Expecting SCAN to return one cell like REDUCE.
  • Starting accumulator incompatible with later math, such as text plus number.
  • Including header cell in the scanned range.
  • Using SCAN for simple running sum when a basic cumulative reference would confuse fewer teammates.
  • Not leaving spill room beside long columns.

Frequently asked questions

SCAN vs running SUM?
SCAN with LAMBDA allows custom rules each step, not only addition.
SCAN output size?
Same length as the input array, one accumulator per element.
SCAN and charts?
Pair running SCAN output with dates for line charts of cumulative metrics.
SCAN vs REDUCE?
SCAN shows all steps. REDUCE shows only the end.
Blank cells in SCAN?
Treat explicitly in LAMBDA or FILTER blanks first.
Can SCAN go horizontal?
Input orientation follows your array; output spills down by default.
SCAN performance?
Long arrays with heavy LAMBDA slow recalc like other array helpers.

Related Tutorials

Watch how SCAN works

Browse more tutorials
Scrape Google Maps

Scrape Google Maps

Scrape any query in Google Maps into your Google Sheets. Enter your API ...
Automatic Screenshots in Apps Script

Automatic Screenshots in Apps Script

Search Every Function in Google Sheets

Search Every Function in Google Sheets

Built a useful tool to filter Google Sheet formulas based on keywords.
Tips to Navigating Thousands of Lines of Code In Apps Script

Tips to Navigating Thousands of Lines of Code In Apps Script

Find out how I use Apps Script built in features to code very quickly an...
How do I reference a different spreadsheet in Apps Script?

How do I reference a different spreadsheet in Apps Script?

I'll show you how to get text from one spreadsheet file to another with ...
Spreadsheet Automation for Beginners

Spreadsheet Automation for Beginners

I start off this video with the idea to show beginners how to automate e...

Related blog posts

Guides that explain SCAN in more depth.

Browse the blog

Related glossary terms

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.