How to Use the LAMBDA Function in Google Sheets | Create and Reuse Custom Functions
What Is the LAMBDA Function?
The LAMBDA function lets you define your own arguments (variables) and formula expression to create a custom function. In addition to testing it standalone in a cell, you can register it as a “Named function” or combine it with helper functions like MAP and BYROW to reuse complex calculations cleanly.
Syntax
=LAMBDA([name1, name2, ...], formula_expression)(value1, value2, ...)
- name1, name2, …: [Optional] The argument names (variables) used inside the formula (e.g.,
x,price,tax_rate). - formula_expression: The formula that performs calculations using the defined arguments (specified as the last argument inside
LAMBDA). - (value1, value2, …): When testing directly on a sheet, specify the actual values or cell references to pass to the arguments inside trailing parentheses.
Example
Here is an example of defining a LAMBDA function to calculate the tax-included total (10% tax) from a pre-tax unit price (Column A) and quantity (Column B), and executing it directly in Column C.
| Row | Column A (Unit Price) | Column B (Quantity) | Formula in Column C | Result in Column C |
|---|---|---|---|---|
| 1 | Unit Price | Quantity | =LAMBDA(price, qty, ROUND(price * qty * 1.1))(A2, B2) |
(Header) |
| 2 | 1000 | 3 | =LAMBDA(price, qty, ROUND(price * qty * 1.1))(A2, B2) |
3300 |
| 3 | 500 | 2 | =LAMBDA(price, qty, ROUND(price * qty * 1.1))(A3, B3) |
1100 |
Common Errors and Notes
#ERROR!(Mismatch Between Parameter Count and Passed Values): An error occurs if the number of parameters defined inLAMBDAdoes not match the number of values passed in the trailing parentheses(value1, value2).- Forgetting Trailing Parentheses Causes an Error: Entering only
=LAMBDA(x, x*2)directly into a cell without passing values results in#ERROR!(because the result would be theLAMBDAfunction itself). When using it directly in a cell, always pass values at the end like(A1), or use it inside a helper function such asMAP. - Parameter Naming Rules: Parameter names cannot be identical to cell references (such as
A1orR1C1) or contain spaces. Use clear names likevalorinput_x.
Frequently Asked Questions
Q. Can I name a LAMBDA function and use it like a regular function instead of writing it directly in a cell?
A. Yes. By registering your LAMBDA expression under Data > Named functions in the menu, you can create a custom function callable anywhere in the sheet, such as =MY_FUNC(A1).
Q. How do I pass arguments when testing a LAMBDA function directly in a cell?
A. Add parentheses immediately after the LAMBDA expression—like =LAMBDA(x, x*1.1)(100)—to pass 100 as the argument and verify the result (110) on the spot.