Category: FUNCTION | Updated: 2026-11-22

How to Use the REDUCE Function in Google Sheets | Aggregate an Array into a Single Final Result

What Is the REDUCE Function?

The REDUCE function processes each element of an array in order while accumulating a value, and returns only the single final aggregated result. Unlike SCAN, which outputs every intermediate step, REDUCE is used when you only want the final value in one cell.

Syntax

=REDUCE([initial_value], array, LAMBDA(accumulator, current_value, formula_expression))
  • initial_value: [Optional] The starting value set in the accumulator at the beginning of the reduction.
  • array: The cell range or array to read sequentially.
  • LAMBDA(accumulator, current_value, formula_expression):
    • accumulator: The variable holding the accumulated value so far.
    • current_value: The variable holding the current element from the array.
    • formula_expression: The formula that updates the accumulator.

Example

Here is an example of replacing all restricted words listed in C2:C4 inside the text in cell A2 with "***" in sequence using a single formula in cell B2.

Row Column A (Original Text) Formula in Column B Column B (Redacted Text) Column C (Restricted Words)
1 Original Text Redacted Text Redacted Text Restricted Words
2 The secret password is 1234 =REDUCE(A2, C2:C4, LAMBDA(acc, word, SUBSTITUTE(acc, word, "***"))) The *** *** is *** secret
3 password
4 1234

Common Errors and Notes

  • Watch the Data Type of initial_value: If you omit initial_value, the first element of the array becomes the initial value. When concatenating text or performing custom aggregations, always specify an explicit initial value such as 0, "", or a target cell to avoid unintended calculation errors.
  • Parameter Order in LAMBDA: In LAMBDA, the first parameter is always the accumulated value (accumulator), and the second parameter is the current element from the array (current_value). Reversing them causes unexpected results or errors.

Frequently Asked Questions

Q. When is the REDUCE function useful?

A. It is very useful when you need to perform operations that standard SUM or COUNT cannot handle—such as replacing multiple keywords in sequence (chaining SUBSTITUTE) or running custom conditional aggregations—and output only the single final result in one cell.

Q. Can I pass text strings as the first argument, initial_value?

A. Yes, you can pass text strings or cell references, not just numbers. For example, passing the original text as initial_value and a list of replacement words as the array enables sequential replacements.