FormulaCraft

SCAN

SCAN applies a LAMBDA function across an array with a running accumulator, similar to REDUCE, but returns an array containing the accumulated value after each element rather than only the final result. It is ideal for computing running totals, cumulative products, or any sequential aggregation where the intermediate values are needed.

Excel
=SCAN(0,A2:A5,LAMBDA(acc,x,acc+x))
Google Sheets
=SCAN(0,A2:A5,LAMBDA(acc,x,acc+x))

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How it works

  1. 1Set up your data range (e.g., A2:A5 with daily sales figures) and choose a starting accumulator value (0 for a running total).
  2. 2Enter =SCAN(0,A2:A5,LAMBDA(acc,x,acc+x)) — it spills a column showing the running total after each row.
  3. 3Adjust the LAMBDA for other running calculations: LAMBDA(acc,x,MAX(acc,x)) tracks the running maximum across the range.

Need a version for your data?

Try: “Calculate a running total of daily sales that updates with each new row

Related

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: