How to Use LAMBDA in Excel: Create Custom Functions Easily
In Excel,
LAMBDA lets you create custom reusable functions by defining a formula with parameters inside a cell. You write =LAMBDA(parameter1, parameter2, ..., calculation) and then call it by name after naming the formula in the Name Manager.Syntax
The LAMBDA function syntax is:
- parameter1, parameter2, ...: These are the inputs your custom function will use.
- calculation: The formula or expression that uses the parameters to return a result.
You define the function with LAMBDA and then assign it a name in Excel's Name Manager to reuse it easily.
excel
=LAMBDA(parameter1, parameter2, ..., calculation)
Example
This example creates a custom function to add two numbers. First, define the function with LAMBDA and name it AddTwoNumbers in Name Manager. Then use =AddTwoNumbers(3, 5) in a cell to get the result.
excel
=LAMBDA(x, y, x + y)(3, 5)
Output
8
Common Pitfalls
Common mistakes when using LAMBDA include:
- Not naming the
LAMBDAformula in Name Manager, so you can't reuse it by name. - Forgetting to provide all required parameters when calling the function.
- Using
LAMBDAwithout calling it immediately or naming it, which returns a function object, not a value.
Example of wrong usage:
=LAMBDA(x, y, x + y) (returns a function, not a number)
Correct usage by immediate call:
=LAMBDA(x, y, x + y)(3, 5) (returns 8)
excel
=LAMBDA(x, y, x + y) =LAMBDA(x, y, x + y)(3, 5)
Output
Function object
8
Quick Reference
| Feature | Description |
|---|---|
| LAMBDA Syntax | LAMBDA(parameter1, parameter2, ..., calculation) |
| Naming | Use Name Manager to assign a name for reuse |
| Calling | Call named function like =FunctionName(arg1, arg2) |
| Immediate Use | Call directly with parameters like =LAMBDA(x,y,x+y)(3,5) |
| Use Case | Create custom reusable formulas without VBA |
Key Takeaways
LAMBDA lets you create custom reusable functions inside Excel without VBA.
Define parameters and a calculation inside LAMBDA, then name it in Name Manager to reuse.
Call LAMBDA functions by name with arguments or immediately by adding parameters after it.
Always provide all parameters when calling your LAMBDA function to avoid errors.
Use LAMBDA to simplify complex formulas and improve spreadsheet clarity.