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

Preserve an outer term after a recursive call

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

The independent sum is 1+2+3+4+5 = 15. Each outer call must retain its own n after the inner call returns. This is a recursion teaching example; SUM or a closed-form expression is simpler for an ordinary consecutive sum. Use 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,IF(n=0,0,self(self,n-1)+n)),f(f,A2))

1 / 3 · 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.