Name the steps of a formula with LET
LET and LAMBDA8 minPremium
Builds on Pull the matching rows with FILTER.
A pricing analyst in Milan writes quotes where the order value appears three times inside one IF: in the test, in the discount and in the answer. When the rule changes, she has to edit it in three places.
How it works
LET( takes pairs of a name and a value, then one last argument, the calculation, which can use the names. Each name can use the ones before it, so a long formula becomes a list of short steps that ends in the result.
Picture a sheet of scrap paper: you work a part out once, write a label next to it, and use the label from then on. LET does the same inside one cell. The formula reads more easily, and a change happens in one place. Excel also works out each part once, however often you use it.
A name exists only inside its own formula. It starts with a letter, has no spaces, and can't look like a cell address: tax1 is refused because TAX1 is a cell, the first one in column TAX.
Example
A sales rep earns 2% of the sales above a $50,000 quota as a bonus, up to $3,000. The sales are in B2.
=LET(over,B2-50000,bonus,over*0.02,IF(over<=0,0,MIN(bonus,3000)))| Name | Holds | With $85,000 in B2 | |
|---|---|---|---|
| 1 | over | B2-50000 | $35,000 |
| 2 | bonus | over*0.02 | $700 |
| 3 | Result | IF(over<=0, | $700 |
- Step 1:
overtakes the sales above the quota: $85,000 minus $50,000. - Step 2:
bonususesover: 2% of $35,000. - Step 3: The result uses both names. over is above 0, so it's the smaller of 700 and 3,000.
Common mistakes
=LET(has no calculation at the end, and Excel won't accept it. The last argument is always the result.net, B2* C2) =LET(uses net before it has a value, and showstax, net* 0.2, net, B2* C2, tax) #NAME?. Name each step after the ones it uses.tax1,q1andvat2026look like cell addresses, so Excel refuses them as names. Use a name such astaxrateortax_1.- A name with a space, such as
net price, is refused too. Writenet_priceornetprice.
In short
=LET(names the parts of a formula, and the last argument is the result.name, value, ..., calculation) - Each name can use the names before it.
- A part you use twice is worked out once, and a change happens in one place.
- Names can't contain spaces or look like cell addresses.
Practice
Premium4 exercises: 3 formulas and 1 quiz question.
Practice is part of Premium
Every lesson is free to read, and you can practice the free lessons without an account. This lesson's exercises are part of Premium, which you add to a free account.
Have one? Sign in