LAMBDA + LET: A Clean Custom Function

Excel Formulas › Advanced

365 / 2021LAMBDALET

Pair LAMBDA with LET to build a tidy, readable custom function: LAMBDA takes the arguments, LET names the intermediate steps inside. The result reads like real code.


Quick formula: name this in Name Manager as, say, NetAfterTax:
=LAMBDA(gross, disc, rate, LET(net, gross*(1-disc), net*(1+rate)))
LAMBDA declares the three inputs; LET names net and uses it for the final result — clean and self-documenting.

Functions used (tap for the full reference guide):

The example

One function: discount a price, then add tax.

AB
1CallResult
2=NetAfterTax(120, 0.1, 0.08)116.64

The formula

LAMBDA for the inputs, LET for the steps:

NetAfterTax = LAMBDA(gross, disc, rate, LET(net, gross*(1-disc), net*(1+rate))) // readable, reusable, named

How it works

The two combine naturally:

  1. LAMBDA lists the function’s parameters: gross, disc, rate.
  2. Its body is a LET that names intermediate values: net, gross*(1-disc).
  3. The LET’s final argument is the result, written with those names.
  4. Save the whole thing in Name Manager as a named function, then call =NetAfterTax(120, 0.1, 0.08) anywhere.

This is the modern Excel pattern. LAMBDA for the interface, LET for the internals — named once, it replaces a sprawling repeated formula with a self-documenting function. Build complex logic step by step in LET so each part is testable.

Try it: interactive demo

Live demo

NetAfterTax(gross, discount, tax).

Result:

Variations

Inline test

Call before naming:

=LAMBDA(g,d,r, LET(n,g*(1-d), n*(1+r)))(120,0.1,0.08)

Add a step

Name more intermediates in LET:

LET(net, ..., tax, net*rate, net+tax)

Compose functions

Call another named LAMBDA inside.

Pitfalls & errors

365/2021 only. Both LAMBDA and LET require modern Excel; older versions return #NAME?.

LET still needs a final result. Inside the LAMBDA body, the LET must end with a result expression after its name/value pairs.

Test inline first. Call the LAMBDA with arguments in a cell to debug, then move the definition (without the call) into Name Manager.

Practice workbook

📊
Download the free LAMBDA + LET: A Clean Custom Function practice workbook
A LAMBDA+LET function (definition + call shown as text/result), the inline-test and extra-step variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I combine LAMBDA and LET in Excel?
Use LAMBDA for the parameters and a LET inside for the steps: =LAMBDA(gross, disc, rate, LET(net, gross*(1-disc), net*(1+rate))). Name it in Name Manager to reuse it.
Why use LET inside a LAMBDA?
LET names intermediate calculations, making the function readable and avoiding repeated sub-expressions — the modern, self-documenting Excel pattern.
How do I test a LAMBDA before naming it?
Call it inline with arguments: =LAMBDA(...)(120, 0.1, 0.08). Once it works, move the =LAMBDA(...) definition into Name Manager without the trailing call.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: LAMBDA function · LET function · Named LAMBDA function

Function references: LAMBDA · LET