SCAN
Returns an array constructed from each of the results of applying a formula to each element of the array and the previous result.
Syntax
=SCAN(initialValue, array, expression)
Arguments
Argument | Type | Description |
---|---|---|
initialValue | Any | Initial value for the previous result |
array | Array | Array of elements |
expression | Lambda | Transformation to perform on each item of the array |
Examples
=SCAN(1, [1, 2, 3], x => x * x.previous)
→[1, 2, 6]
SCAN
formula is called for each item in the array (the values 1, 2, and 3). For each item, the value is multiplied by the previous value, resulting in an array containing the running multiplication: [1, 2, 6].
Updated 9 months ago