# SCAN Function

> Return every intermediate accumulator value of a LAMBDA as an array with SCAN in TX Sheet Control: running totals, start value, spilling and #VALUE!.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Function
- **Path:** TX Sheet Control > API Reference > Formula Functions > SCAN Function
- **252 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/scan/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/scan/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/scan/llms-full.txt

---

Apply a LAMBDA to each element of an array in turn and return every intermediate value as an array. `array_or_initial` is the start value of the accumulator (empty when omitted), `array_or_lambda` the array, and `lambda` a LAMBDA with two parameters, the accumulator and the current element, whose result becomes the new accumulator. The result has the size of the array and spills. A third argument that is not a LAMBDA returns `#VALUE!`. [REDUCE](https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/reduce/llms-full.txt) returns only the final value.

### Syntax

```text
SCAN(array_or_initial, array_or_lambda, lambda)
```

Category: Logical. Minimum arguments: 3. Maximum arguments: 3.

Available for supported offline calculation.

### Examples

```text
=SCAN(0,{1,2,3},LAMBDA(acc,x,acc+x))
```

The formula returns the running totals 1, 3 and 6.

Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.

### See Also

- [Formulas](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/formulas/llms-full.txt)
- [Custom Functions and Formula Data](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/custom-functions/llms-full.txt)

---

## Nearby

- **Previous:** [RTD Function](https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/rtd/llms-full.txt)
- **Next:** [SEARCH Function](https://docs.textcontrol.com/tx-sheet-control/reference/formula-functions/search/llms-full.txt)
