LAMBDA in Google Sheets: A Practical Explainer
July 16th, 2026
LAMBDA lets you write your own custom function inside a formula — no Apps Script required. Once you get comfortable with it, a handful of other functions (MAP, REDUCE, SCAN, BYROW, BYCOL, MAKEARRAY) unlock, since they all take a LAMBDA as their last argument. This post walks through the syntax and the most useful patterns.
The basic idea
A LAMBDA has two parts: the names of its parameters, and a formula that uses them. The last argument is always the formula; everything before it is a parameter name.
=LAMBDA(x, x^2)
This defines a function that squares whatever you pass it. On its own, typing this into a cell just returns the function definition — it doesn't calculate anything yet. To actually run it, wrap it in parentheses and call it with a value:
=LAMBDA(x, x^2)(5)
This returns 25. You can also give it more than one parameter:
=LAMBDA(x, y, x + y)(3, 4)
This returns 7.
Naming a LAMBDA for reuse
Writing out LAMBDA(x, x^2)(5) every time is tedious. Instead, use Data > Named functions in Google Sheets to save a LAMBDA under a name, like SQUARE. Once saved, you can call it anywhere in the spreadsheet just like a built-in function:
=SQUARE(5)
This is the closest thing Sheets has to writing your own reusable function without Apps Script.
Where LAMBDA really pays off: array functions
LAMBDA becomes much more useful when combined with the functions built to consume it. These all apply your custom logic across a range, without helper columns or ARRAYFORMULA gymnastics.
MAP
MAP applies a LAMBDA to every value in one or more arrays and returns an array of the results.
=MAP(A2:A10, LAMBDA(price, price * 1.2))
Adds 20% to every price in A2:A10, returning a new array — the original data stays untouched.
REDUCE
REDUCE collapses an array into a single accumulated value, applying a LAMBDA at each step.
=REDUCE(0, A2:A10, LAMBDA(acc, value, acc + value))
This is a manual (but flexible) way to sum a range — you can swap the logic for anything, like a running maximum or a conditional total.
SCAN
SCAN works like REDUCE, but instead of returning just the final result, it returns every intermediate step as an array — handy for running totals.
=SCAN(0, A2:A10, LAMBDA(acc, value, acc + value))
Returns a running total alongside each row of A2:A10.
BYROW and BYCOL
BYROW and BYCOL apply a LAMBDA to each row or column of a range and return one result per row/column.
=BYROW(A2:C10, LAMBDA(row, SUM(row)))
Returns the sum of each row in A2:C10 as a column of results.
MAKEARRAY
MAKEARRAY builds a new array from scratch using a LAMBDA that receives the row and column index for each cell.
=MAKEARRAY(3, 3, LAMBDA(row, col, row * col))
Generates a 3×3 multiplication table.
When to reach for LAMBDA
- You're repeating the same formula logic in many cells or many sheets — a named LAMBDA keeps it in one place.
- You need row-by-row or column-by-column logic that doesn't map cleanly to a single built-in function.
- You want a running calculation (SCAN) or custom aggregation (REDUCE) that SUM/AVERAGE/etc. can't express directly.
If you're just doing straightforward math or lookups across a range, ARRAYFORMULA or the built-in aggregate functions are usually simpler — save LAMBDA for logic that's genuinely custom.