Modern · Custom functions without VBA

LAMBDA

Build your own reusable Excel functions in pure formula language — no VBA, no scripts, no macros. LAMBDA is the biggest addition to Excel in decades, turning the formula bar into a real programming environment.

=LAMBDA(param1, param2, ..., calculation)(argument1, argument2, ...)

Creates a function-like formula that accepts parameters and returns a calculated result. Combined with Name Manager, LAMBDA lets you create custom named functions available across the entire workbook.

Category
Modern / Meta
Returns
Any value or array
Available since
Excel 365 (2022)

What LAMBDA does

Until 2022, if you wanted to create a custom function in Excel — say, a temperature converter or an inventory-days calculator — you had exactly two options: paste the same messy formula everywhere, or write VBA. LAMBDA changed that. Now you can define a reusable function directly in the formula bar, give it a name via the Name Manager, and call it like any built-in function throughout your workbook.

The magic is that LAMBDA functions live in the workbook, not in a separate script. They travel with the file. Anyone opening the workbook can use them. No enabling macros, no security prompts, no VBA developer settings. This is the closest Excel has ever come to being a proper functional programming environment — and it's opened the door to sophisticated custom logic that was previously stuck behind the VBA barrier.

💡 The two ways to use LAMBDA

1. Inline (one-off): use LAMBDA directly with arguments passed in the same formula. Good for testing.

2. Named (reusable): save the LAMBDA to Name Manager with a descriptive name like "CelsiusToFahrenheit", then call it as =CelsiusToFahrenheit(A2) anywhere in the workbook. This is where LAMBDA becomes truly powerful.

Syntax breakdown

param1, param2, ...Required

Named parameters your function accepts. Choose descriptive names like temperature, revenue, rate. Up to 253 parameters allowed. Names must be valid Excel identifiers (no spaces, no starting with a number).

calculationRequired

The formula that uses the parameters and produces the result. Can be any valid Excel formula, including nested functions, other LAMBDAs, and array operations.

(argument1, argument2, ...)Inline mode

Values passed to the LAMBDA in parentheses immediately after. Only used for inline invocation. When you save to Name Manager, you'll pass arguments through the named function instead.

How to save a LAMBDA to Name Manager

  1. Write and test your LAMBDA inline first: =LAMBDA(c, c*9/5+32)(20) returns 68 (20°C = 68°F).
  2. Once it works, copy just the LAMBDA part (without the trailing arguments): =LAMBDA(c, c*9/5+32)
  3. Go to Formulas ribbon → Name Manager → New.
  4. Give it a name like CelsiusToFahrenheit. Paste the LAMBDA into "Refers to". Click OK.
  5. Now use it anywhere: =CelsiusToFahrenheit(A2) — behaves like any built-in function.

5 real-world examples

Example 1 · Temperature converter

Celsius to Fahrenheit as a reusable function

Inline test then save to Name Manager as CToF.

=LAMBDA(celsius, celsius * 9/5 + 32)(25)
Result: 77 (25°C = 77°F)

After saving to Name Manager: =CToF(A2) works anywhere. Clean, readable, self-documenting.

Example 2 · Tax calculator with brackets

Progressive tax calculation as a reusable function

Multi-bracket tax with clean parameter names. Save as CalculateTax.

=LAMBDA(income, IFS(income<=10000, income*0.10, income<=40000, 1000 + (income-10000)*0.15, income<=85000, 5500 + (income-40000)*0.22, TRUE, 15400 + (income-85000)*0.32))
Result: the correct progressive tax owed

Call as =CalculateTax(F2). All the bracket logic hidden behind a clean function name.

Example 3 · Multi-parameter tip calculator

Split bill with tax and tip

Three-parameter LAMBDA: subtotal, tax rate, tip percentage, people count. Save as SplitBill.

=LAMBDA(subtotal, taxRate, tipPct, people, ROUND((subtotal * (1+taxRate) + subtotal*tipPct) / people, 2))(120, 0.08, 0.18, 4)
Result: $38.85 per person

Descriptive parameter names make the calculation self-documenting. Save to Name Manager for reuse.

Example 4 · Days-until with weekends excluded

Business days until a deadline

Uses NETWORKDAYS internally. Save as BusinessDaysUntil.

=LAMBDA(deadline, NETWORKDAYS(TODAY(), deadline))
Result: number of business days between today and the deadline

Call as =BusinessDaysUntil(dueDate). Wraps a common pattern into readable syntax.

Example 5 · Recursive LAMBDA

Sum digits of a number recursively

LAMBDAs can call themselves — required saving to Name Manager first. Save as SumDigits.

=LAMBDA(n, IF(n<10, n, MOD(n,10) + SumDigits(INT(n/10))))
Result: for input 12345, returns 15 (1+2+3+4+5)

The LAMBDA calls itself by name — which is why saving to Name Manager is required for recursion. Powerful for tree traversals and cumulative logic.

Common errors and how to fix them

#CALC!

LAMBDA called without arguments

You wrote =LAMBDA(x, x*2) in a cell — this defines the function but doesn't call it, so Excel returns #CALC!.

Fix: add arguments in trailing parens — =LAMBDA(x, x*2)(5) — or save to Name Manager and call by name.
#NAME?

Named LAMBDA doesn't exist

You wrote =MyFunction(A2) but haven't defined MyFunction in Name Manager. Excel doesn't recognize the name.

Fix: Formulas → Name Manager → New — define the LAMBDA under the correct name.
#VALUE!

Wrong number of arguments passed

Your LAMBDA takes 3 parameters but you passed 2 (or 4). Excel expects exact matches.

Fix: count parameters in Name Manager. Common when refactoring — LAMBDA parameter counts change but call sites don't.
#NUM!

Infinite recursion in LAMBDA

Your recursive LAMBDA never hits its base case. Excel stops after 1024 recursion levels.

Fix: verify your termination condition — e.g., IF(n<=0, ...) must be reachable. Add debugging prints via LET.

See our Formula Errors guide for more.

LAMBDA vs LET vs VBA

LAMBDA Use when: you need a reusable function called from multiple cells. Custom business logic, calculations you use frequently, wrapped domain-specific formulas.
LET Use when: you need to reuse a value within a single formula. Doesn't create a function — just named intermediate values. Read our LET guide.
VBA Use when: you need to interact with Excel objects (files, sheets, ranges), automate workflows, or perform actions beyond calculation. LAMBDA can't do actions; VBA can.
Named Range Use when: you need a named reference to a cell or range. LAMBDA names computations; named ranges name references. Both live in Name Manager.

Version compatibility

Excel 365
✓ Full support
Excel 2021
✓ Full support
Excel 2019
✗ Not available
Excel 2016
✗ Not available
Excel Online
✓ Full support
Excel Mac (365)
✓ Full support
Excel iPad
✓ Full support
Google Sheets
✓ Since 2022

Related functions

📥 Download the practice workbook

All 5 examples above with Name Manager entries pre-configured. Includes 10 bonus reusable LAMBDA functions to steal.

Workbook coming soon — check back after our team releases it.

Frequently asked questions

Is LAMBDA a replacement for VBA?

For calculations, yes. LAMBDA covers most user-defined function scenarios without VBA. But VBA still wins for anything involving actions — reading files, sending emails, manipulating Excel objects, running macros. Rule of thumb: if it's just math or text processing, LAMBDA. If it interacts with the Excel environment, VBA.

Do LAMBDA functions travel with the workbook?

Yes. LAMBDAs saved to Name Manager are stored in the workbook file itself. Send the file to a colleague, they can use your custom functions immediately. No macro-enabling, no security prompts. This is the biggest advantage over VBA.

Can I create global LAMBDAs available in every workbook?

Not natively. Each LAMBDA lives in its workbook. For cross-workbook sharing, add-ins can distribute LAMBDA libraries — Microsoft's official "Excel Labs" add-in offers this, and the community has built libraries like PowerFX-style LAMBDA collections you can install.

How do I document a LAMBDA for others?

Use descriptive parameter names (revenue not r), name the function clearly in Name Manager, and add a comment in the Name Manager's "Comment" field explaining what it does and what parameters mean.

Can LAMBDA return an array?

Yes. If the calculation produces an array (e.g., using FILTER or SEQUENCE), the LAMBDA returns the whole array. Combined with dynamic arrays, this enables sophisticated one-cell-in, many-cells-out functions.

How do I debug a complex LAMBDA?

Two techniques: (1) use LET inside the LAMBDA to name intermediate values, then output them to check each step; (2) test with tiny inputs first — feed simple values through and verify each stage. Formula → Evaluate Formula also steps through LAMBDA execution.

Are recursive LAMBDAs performant?

For small inputs, yes. For deep recursion (500+ levels), Excel gets slow. If performance matters, prefer iterative solutions using SCAN or REDUCE. Recursion works but isn't Excel's optimization sweet spot.

Custom Excel functions, written for you.

Describe what you want — "function that converts weight units with any input" — and the Add-in writes the LAMBDA and Name Manager entry.

Get the Add-in →