SCAN
The SCAN
function in Google Sheets is used to scan an array and produce intermediate values by applying a LAMBDA
function to each value. It returns an array of the intermediate values obtained at each step.
Function Syntax and Parameters
Syntax: SCAN(initial_value, array_or_range, LAMBDA)
Parameters:
initial_value
: The initial value for the scan.array_or_range
: The array or range to scan.LAMBDA
: The function to apply to each value in the array.
Step-by-Step Tutorial
-
Using
SCAN
with a simple lambda function:- Example:
=SCAN(0, {1,2,3,4,5}, LAMBDA(a, b, a + b))
- Result:
{0, 1, 3, 6, 10, 15}
- Example:
-
Using
SCAN
with more complex lambda functions:- Example:
=SCAN("", {"apple", "banana", "carrot"}, LAMBDA(a, b, a & ", " & b))
- Result:
{", apple", ", apple, banana", ", apple, banana, carrot"}
- Example:
Use Cases and Scenarios
- Running Total: Calculate the running total of a series of values.
- Concatenation: Concatenate values in a range with separators.
- Accumulating Values: Accumulate values with a specific operation.
Related Functions
None.
Related Articles
None.