Practice free

REDUCE function

REDUCE walks through an array, carrying a running result, and returns only the final value. Use it for custom totals or combining items in a way SUM cannot.

Example

Read it as a sentence: start with 1, multiply it by each value in D2:D3, the Qty column, in turn, which gives 84.

Practice this in the app

Syntax

REDUCE([initial_value], array, lambda)

Arguments in [square brackets] are optional.

initial_value (optional)
Starting value of the accumulator.
array (required)
The array to loop over.
lambda (required)
A LAMBDA(accumulator, value) returning the new accumulator.

Returns: A single final value after processing every element.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=REDUCE(0,{1,2,3},LAMBDA(a,v,a+v)) 6 Sum
=REDUCE(,{1,2},LAMBDA(a,v,a+v)) 3 Omitted initial value
=REDUCE("",{"a","b"},LAMBDA(a,v,a&v)) ab Text accumulator
=REDUCE(0,{1,2;3,4},LAMBDA(a,v,a+v)) 10 2D array
=REDUCE(0,{1,2},LAMBDA(a,v,VSTACK(a,v))) 0 Array accumulator spills
=REDUCE(1,Items!D2:D3,LAMBDA(a,v,a*v)) 84 Product over range
=REDUCE(0,{1,2},LAMBDA(a,a)) #VALUE! One-parameter lambda
=REDUCE(0,{1,2},5) #VALUE! Not a lambda

The Items sheet these formulas read

Watch out for

  • If you omit initial_value, the first array item is used as the start.
  • Use SCAN if you need each running value, not just the final one.

Where it works

Excel
REDUCE arrived in Excel 2024. Older versions do not have it. Dynamic-array LAMBDA family; in 365 and Excel for the web, and Excel 2024. Check older perpetual versions.
Google Sheets
Same name, same behaviour for everyday use.

Part of Logical functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .