SCAN
Description
Applies a LAMBDA function to each value in an array and returns an array of values with each intermediate value.
This formula is useful for creating running totals, cumulative sums, or other calculations that show the results after each step.
Syntax
SCAN(
initial_value
, array
, lambda
) - initial_value: The starting value for the accumulator.
- array: The array of values to be scanned.
- lambda: The LAMBDA that defines the operation to reduce the array. There are three parameters:
- accumulator: The value returned as the final result.
- value: The current value from the array.
- body: The calculation applied to each element in the array.