1. Home
  2. Functions
  3. Array
  4. SCAN

SCAN function

Applies a LAMBDA to each value with a running accumulator and returns every intermediate result.

Syntax

=SCAN(initial_value, array, lambda)

Arguments

ArgumentRequiredDescription
initial_valueRequiredThe starting accumulator
arrayRequiredThe array to go through
lambdaRequiredLAMBDA(accumulator, value)

How to use SCAN

When SCAN returns more than one value, the result spills into the cells below and to the right. Keep those cells empty, or you get #SPILL!.

SCAN takes 3 required arguments. Type =SCAN( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=SCAN(0, {1,2,3}, LAMBDA(a, v, a+v))Result 1 by 3 array
Spilled result
ABC
1136

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.