Array

LAMBDA Formula

Creates a custom, reusable function that you can call inline or assign to a name for repeated use. LAMBDA is a breakthrough feature that lets you define your own formulas with parameters, eliminating the need for helper columns and enabling functional programming patterns like MAP, REDUCE, and SCAN.

Syntax

LAMBDA([parameter1, ...], calculation)
ParameterDescription
[parameter1 (Optional.) Parameter of the LAMBDA function.
...] Parameter of the LAMBDA function.
calculation Parameter of the LAMBDA function.
Try LAMBDA in Viztab — free, no signup

Examples

Inline custom function

Formula
=LAMBDA(celsius, celsius*9/5+32)(100)
212. Defines a Celsius-to-Fahrenheit converter and immediately calls it with 100. Returns 212°F.

Reusable named function

Formula
=CtoF(37)
98.6. After defining the Name 'CtoF' as =LAMBDA(c, c*9/5+32), you can call it like any built-in function. 37°C = 98.6°F.

Multi-parameter LAMBDA

Formula
=LAMBDA(price, tax, qty, price*(1+tax)*qty)(29.99, 0.08, 3)
97.17. Calculates total cost with tax for 3 items at $29.99 with 8% tax.

Common Errors

#VALUE!

Wrong number of arguments passed to the LAMBDA. If it expects 2 parameters but receives 3, you get this error.

#CALC!

The LAMBDA body returns an error, or recursive LAMBDAs exceed the call depth limit.

Tips

Assign to a Name for reuse

Go to Formulas > Name Manager > New Name, enter a name like 'CtoF', and set the formula to =LAMBDA(c, c*9/5+32). Now =CtoF(100) works everywhere.

Essential for MAP, REDUCE, SCAN

These array functions require a LAMBDA as input. Master LAMBDA first, then MAP/REDUCE become intuitive.

Last parameter is the calculation

In LAMBDA(a, b, a+b), the last expression (a+b) is the return value. Everything before it is a parameter name.

Try LAMBDA in Viztab

Import your data and use LAMBDA with 370+ other formulas. No signup required.

Open Viztab

Related Formulas