SCAN Function
The SCAN
function in Google Sheets applies a specified LAMBDA
function to accumulate values in an array or range.
Syntax
SCAN(initial_value, array_or_range, LAMBDA)
initial_value
: The starting value for the accumulation.array_or_range
: The range or array to accumulate.LAMBDA
: A custom function to apply to each element.
Examples
- Basic Example
Accumulate the sum of values in range A1:A5
starting from an initial value of 0:
=SCAN(0, A1:A5, LAMBDA(acc, x, acc + x))
Notes
- Returns an array of accumulated values.
Related Functions
REDUCE
: Apply a function to reduce an array.