In Excel: use =LAMBDA(parameters, calculation) — defined in Name Manager it becomes a reusable custom function you can call by name, with no VBA.
Syntax
Arguments
| Argument | Description | |
|---|---|---|
parameter1 | required | A name for the first input the function will accept. |
calculation | required | The expression to evaluate, using the parameter names. |
Related functions
Build and test the formula normally in a cell until it returns the right answer.
Replace the cell references with parameter names inside a LAMBDA wrapper and test it inline with trailing arguments.
Open Formulas → Name Manager, create a new name, and paste the LAMBDA as its definition.
Call it by that name anywhere in the workbook, as you would a built-in function.
Need it as an auditable file?
Ships inside the linked template — formula-driven, unlocked, audit-ready.
What this does
LAMBDA lets you define your own function in the formula language itself. On its own in a cell it is not much use; the point is to save it in Name Manager under a name, after which that name works like any built-in function throughout the workbook. That turns a gnarly formula pasted into forty places into one definition with one place to fix. It also means custom logic can ship in a macro-free .xlsx, which VBA never allowed. Combined with the helper functions MAP, REDUCE and SCAN it can iterate over arrays. Requires Excel 365. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “excel lambda function”. Start on a copy or a tiny sample, keep the affected formula visible, and compare the result with the tool above before you touch the real workbook. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. The point is a calculation you can defend to a CFO or an auditor, but the practical win is that someone else can open the file and understand what happened without asking you.
A worked example
A margin calculation used across a workbook: define =LAMBDA(price, cost, (price-cost)/price) in Name Manager as MARGIN, then write =MARGIN(B2, C2) in any cell. To test it before naming it, call it inline: =LAMBDA(price, cost, (price-cost)/price)(100, 62) returns 0.38. LAMBDA turns a copy-pasted formula into a defined function with one place to fix, which is the first real answer Excel has had to formula duplication. A practical tip before you scale it up: build it once on a small block of test data, confirm the number against the tool on this page, and only then point it at your real sheet. That one habit catches almost every mistake while it is still cheap to fix, long before a wrong figure reaches a report or a colleague.
In Google Sheets
If you are in Google Sheets rather than Excel, the good news is that the formula shown here is identical and the workflow barely changes — menus sit across the top instead of in a ribbon, and a few function names differ slightly, but anything you build here moves across with little or no rework. Nothing on this page is behind a login: the tool runs entirely in your browser, the formula is shown in full with one-click copy, and the steps work the same on Windows and Mac. That is the whole promise here — the exact answer, a way to prove it on your own numbers, and just enough context to make it stick. Treat “excel lambda function” as a small building block rather than a chore. Once the inputs sit in their own cells and the formula reads from them, the same setup answers a dozen related questions with a tweak, and Excel keeps every dependent figure current as the data changes. The tool above is there so you can rehearse and verify before committing anything to a real workbook; the steps and worked example are there so the logic sticks. Get it right once and it stops costing you time — it starts saving it, every time the question comes back around.
Common mistakes
- Leaving a bare
LAMBDAin a cell without calling it, which returns#CALC!. - Referencing a cell directly inside the
LAMBDAinstead of passing it as a parameter, which defeats the reusability. - Sharing the workbook with users on older Excel, where every call returns
#NAME?.
Frequently asked questions
How do I make a custom function without VBA?
Write it as a LAMBDA and save it in Name Manager. It then works like a built-in and needs no macro-enabled file format.
Why does my LAMBDA return #CALC!?
It is defined but never called. Either add arguments in trailing brackets, or name it and call it by name.
Can a LAMBDA loop?
Yes, through the helper functions MAP, REDUCE, SCAN, BYROW and BYCOL, and by calling itself recursively once it is named.