# SCAN

## Content

This function scans an array by applying a [LAMBDA](/spreadjs/docs/v17/formulareference/FormulaFunctions/other-functions/lambda-function) to each value and returns an array that has each intermediate value.

## Syntax

`SCAN([initial_value], array, lambda(accumulator, value))`

## Argument

This function has the following arguments:

| Argument | Description |
| -------- | ----------- |
| *[initial\_value]* | (Optional) Sets the starting value for the accumulator. |
| *array* | An array to be scanned. |
| *lambda* | A LAMBDA that is called to scan the array.<br>The LAMBDA takes two parameters:<ul><li>*accumulator*: The value totaled up and returned as the final result.</li><li>*value*: The calculation applied to each element in the array.</li></ul> |

## Remarks

* Use the initial\_value argument to set the starting value for the accumulator parameter. If you are working with text, set the initial value to "".
* If an invalid LAMBDA function or an incorrect number of parameters are provided, it returns a #VALUE! error called "Incorrect Parameters".

## Data Types

Returns an array.

## Examples

`SCAN(1, A1:C2, LAMBDA(a,b,a*b))`
`SCAN("",A1:C2,LAMBDA(a,b,a&b)`