Skip to main content
← All functions

LAMBDA function

Create custom, reusable functions and call them by a friendly name

Use a LAMBDA function to create custom, reusable functions and call them by a friendly name. The new function is available throughout the workbook and called like native Excel functions.

Syntax

LAMBDA([parameter], calculation)

Square brackets indicate optional arguments.

Arguments

ArgumentRequiredMeaning
parameterNo · repeatsA value that you want to pass to the function, such as a cell reference, string or number. You can enter up to 253 parameters. This argument is optional.[x, y, …,]
calculationYesThe formula you want to execute and return as the result of the function. It must be the last argument and it must return a result. This argument is required.x+y

Try LAMBDA

Carry a starting balance through recursive steps

=LET(f,LAMBDA(self,n,acc,IF(n=0,acc,self(self,n-1,acc+n))),f(f,A2,B2))

Starting from 10, add 5+4+3+2+1 to obtain 25. The recursive call carries both the remaining count and the accumulated value. Keep the count a small nonnegative integer. The first argument passes the function itself explicitly; it is not a workbook name. Native Excel and Sheets recalculation still needs verification.

Inspect the current formula

Read its written arguments or observe actual operation values in a separate local calculation. This action neither applies a draft nor grades an answer.

Read the formula, one argument at a time

Explore the written function calls and their inputs. The calculation result belongs to the complete formula.

LAMBDA · inside LET

=LET(f,LAMBDA(self,n,acc,IF(n=0,acc,self(self,n-1,acc+n))),f(f,A2,B2))

1 / 4 · parameter

A value that you want to pass to the function, such as a cell reference, string or number. You can enter up to 253 parameters. This argument is optional.

This position uses a repeatable parameter template from the function reference. The number above identifies its position in this call.

LAMBDA reference ↗

Follow the cells behind a result

Read explicit local references and helper formulas using a separate calculation. Your draft stays in this field; the worksheet and practice checks do not change.

The worksheet runs locally. Published checks apply to the supplied example only. Native Excel and Google Sheets compatibility remain unverified.

Practice a complete task

Reference and compatibility

Univer 1.0.4 / Apache-2.0. Calculation checks cover the supplied examples only. The browser worksheet does not implement every Excel feature, external service or connected data type.