
Learn more about working with Lambda Functions, Named Functions, and X-Functions in the FREE Lambda Functions 10-Day Challenge course
The SCAN function in Google Sheets scans an array and applies a LAMBDA function to each value, moving row by row. The output is an array of intermediate values obtained at each step.
It’s hard to understand without seeing an example, so let’s do that.
The most straightforward SCAN formula is to create a running total calculation on a column of numbers.
The formula is:
=SCAN(0,A2:A11,LAMBDA(runningTotal,currentValue,runningTotal + currentValue))
Which produces this array output:
The lambda simply adds together the current running total and the new value, then returns the answer to the output array.
When all of the values from the input array have been considered, the output array is returned.
🔗 Get this example and others in the template at the bottom of this article.
Continue reading SCAN Function in Google Sheets – LAMBDA Helper Function