Practice free

LAMBDA function

LAMBDA lets you define your own function inside a formula and name it in Name Manager, so you can reuse logic you repeat. It is also the engine behind MAP and similar helpers.

Example

Read it as a sentence: build a function that multiplies x by y, then run it with 3 and 4, which gives 12.

Practice this in the app

Syntax

LAMBDA([parameter1, ...], calculation)

Arguments in [square brackets] are optional.

parameter1, ... (optional)
Names for the inputs your function accepts.
calculation (required)
The formula using those names; always the last argument.

Returns: A reusable custom function (or its result when called).

What Excel actually returns

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

FormulaExcel showsCase
=LAMBDA(x,x*2)(5) 10 Called
=LAMBDA(x,x+1)({1,2,3}) 2 Array arg spills
=LAMBDA(x,y,IF(ISOMITTED(y),x,x+y))(1,) 1 Omitted optional arg
=LAMBDA(x,x*2) #CALC! Not called
=LAMBDA(x,y,x+y)(1) #VALUE! Too few args
=LAMBDA(x,x)(1,2) #VALUE! Too many args
=LAMBDA(5) #CALC! Body only

Watch out for

  • A bare LAMBDA shows #CALC! until you call it, e.g. =LAMBDA(x,x*2)(5).
  • Save it in Name Manager to reuse it across the workbook.
  • Recursion is possible but easy to get wrong.

Where it works

Excel
LAMBDA arrived in Excel 2024. Older versions do not have it. 365 and Excel for the web; Excel 2024 appears to include it. 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 .