Used for questions related to custom lambda functions in Excel.
Custom functions in Excel used to be written using VBA or JavaScript. Since the introduction of LAMBDA it's possible to define custom functions using Excel’s formula language. They don't require enabling macros.
Syntax:
=LAMBDA([parameter1, parameter2, …,] calculation)
parameter. A value to pass to the function, e.g. a cell reference, string or number. Accepts up to 253 parameters. This argument is optional.
calculation. The formula to execute and return as the result. It must be the last argument and it must return a result. This argument is required.
If used as an example in a cell, it can be put like this:
=LAMBDA(x,x^2)(5)
5 is the number which is passed to the function. It takes the place of x
, in the calculation x^2
. So, the actual calculation in this case is 5^2. It gives the result of 25.
To be able to reuse lambda functions they must be put into Excel's Name Manager. Using the previous example, =LAMBDA(x,x^2)
should be put in the Refers to: section and some name should be provided in the Name: section (e.g., SQUARE). Then this function will become available in the workbook by its name =SQUARE()
.