Why your longest Excel formula is probably repeating itself
If you have ever opened a workbook and found a formula that runs across the whole screen, you know the feeling. Somewhere in the middle there is a piece like B2*C2*(1-D2), and then the same piece again, and a little later once more. Nobody remembers why it was written that way, and nobody wants to touch it. This lesson is for analysts, finance and operations people, shop owners and anyone else who builds calculations that other people have to trust. You will learn the one function that fixes this problem at its root: LET.
We work with Alder & Finch, a fictional online furniture store. Every order has a quantity, a unit price and a discount. The net value of an order decides the shipping charge: from a net value of 1,500 shipping is free, below that it costs 4% of the net value but at least 35. The old shipping formula calculated the net value three times in a single cell. Every one of those repetitions is a place where a typo can hide, and Excel works out each repetition again on every recalculation. With LET you calculate the net value once, give it a name and reuse that name as often as you like.
By the end of this article you will understand how LET works, why it makes formulas both easier to read and cheaper to calculate, how to write and debug one step by step in Excel, and which mistakes trip up most people the first time. The interactive lab above uses exactly the same ten orders, so you can try every formula as you read.
What LET does, in plain words
LET lets you give a name to an intermediate result inside a single formula. Its syntax is =LET(name1, value1, [name2, value2, …], calculation). You write pairs: first a name, then the value or expression that name stands for. After the last pair comes one final argument, the calculation, and that is what the cell returns. A minimal example is =LET(gross,B2*C2,gross*(1-D2)): Excel calculates B2*C2, stores it under the name gross, and then returns gross*(1-D2).
Three properties make LET powerful. First, the names exist only inside that one formula. They do not appear in the Name Manager and they do not clash with names in other cells. Second, each value is calculated once, no matter how often you use its name afterwards. Microsoft describes this as one of the main reasons to use LET: a repeated expression no longer has to be evaluated again and again. Third, later names can use earlier names. That means you can build a calculation in small steps, exactly the way you would explain it to a colleague.
net, and reused by ship and by the final result.
Think of LET as a small recipe written into a single cell. The ingredients are cell references, every intermediate step gets a label, and the last line says what to serve. When you read =LET(net,B2*C2*(1-D2),ship,IF(net>=$B$14,0,MAX($B$16,net*$B$15)),net+ship) from left to right, it tells a story: the net value is quantity times price minus discount, shipping is zero above the limit and otherwise a percentage with a minimum, and the total is net plus shipping. The nested version without LET tells the same story, but you have to decode it.
#NAME? error. Check which versions your audience uses before you roll LET out across a shared workbook.Worked example: ten Alder & Finch orders
Here are the ten orders from the lab, with the three result columns already calculated. The rules sit in B14:B16 of the lab sheet: free shipping from 1,500 (B14), a shipping rate of 4% (B15) and a minimum shipping charge of 35 (B16). All names and numbers are fictional.
| Order | Qty | Unit price | Discount | Net (E) | Shipping (F) | Total (G) |
|---|---|---|---|---|---|---|
| AF-3101 | 2 | 489 | 0% | 978.00 | 39.12 | 1,017.12 |
| AF-3102 | 1 | 1,590 | 10% | 1,431.00 | 57.24 | 1,488.24 |
| AF-3103 | 4 | 129 | 10% | 464.40 | 35.00 | 499.40 |
| AF-3104 | 1 | 2,150 | 10% | 1,935.00 | 0.00 | 1,935.00 |
| AF-3105 | 6 | 89 | 0% | 534.00 | 35.00 | 569.00 |
| AF-3106 | 2 | 749 | 0% | 1,498.00 | 59.92 | 1,557.92 |
| AF-3107 | 3 | 349 | 5% | 994.65 | 39.79 | 1,034.44 |
| AF-3108 | 1 | 1,690 | 0% | 1,690.00 | 0.00 | 1,690.00 |
| AF-3109 | 8 | 59 | 15% | 401.20 | 35.00 | 436.20 |
| AF-3110 | 2 | 995 | 10% | 1,791.00 | 0.00 | 1,791.00 |
Column E uses the simplest LET: =LET(gross,B2*C2,gross*(1-D2)). Order AF-3102 has one item at 1,590 with a 10% discount, so gross is 1,590 and the net value is 1,590 × 0.9 = 1,431. Column F names the net value and applies the shipping rule: =LET(net,B2*C2*(1-D2),IF(net>=$B$14,0,MAX($B$16,net*$B$15))). For AF-3102 that is 1,431 × 4% = 57.24, which is more than the minimum of 35, so shipping is 57.24. For AF-3103 the net value is 464.40, and 4% of it is only 18.58, so the minimum of 35 applies.
Column G puts both steps into one formula: =LET(net,B2*C2*(1-D2),ship,IF(net>=$B$14,0,MAX($B$16,net*$B$15)),net+ship). The name ship is defined using net, and the final calculation adds the two. AF-3104 has a net value of 1,935, above the limit, so its total is exactly 1,935.00. AF-3106 is the interesting one: two items at 749 with no discount give a net value of 1,498, just 2 below the limit, so the customer pays 59.92 in shipping. That is the kind of insight a clean formula helps you see, and a good conversation starter for a marketing team that wants to nudge customers over the limit.
Finally, cell B18 counts how many orders ship free, with one formula over the whole range: =LET(net,B2:B11*C2:C11*(1-D2:D11),SUM(--(net>=B14))). Here net is not a single number but an array of ten net values. The comparison net>=B14 returns ten TRUE/FALSE values, the double minus turns them into ones and zeros, and SUM adds them up. The answer is 3 (AF-3104, AF-3108 and AF-3110). If you had counted by gross value instead, AF-3102 would wrongly be included, because its gross value of 1,590 is above the limit but its net value of 1,431 is not.
Before and after: what LET changes
The table below puts the classic nested formula next to the LET version for the order total. Both return exactly the same numbers. The difference is how easy each one is to read, check and change.
| Nested formula (no LET) | LET formula | |
|---|---|---|
| Formula in G2 | =B2*C2*(1-D2)+IF(B2*C2*(1-D2)>=$B$14,0,MAX($B$16,B2*C2*(1-D2)*$B$15)) | =LET(net,B2*C2*(1-D2),ship,IF(net>=$B$14,0,MAX($B$16,net*$B$15)),net+ship) |
| Times the net value is written | 3 | 1 |
| Times the net value is calculated | up to 3 per cell | 1 per cell |
| What a reader sees | a wall of cell references | named steps: net, ship, result |
| Changing the discount logic | edit three places, hope they match | edit one place |
The nested version is not wrong, but it is fragile. Suppose the business decides that the discount should only apply to the first item. In the nested formula you have to change three copies of the same expression and make sure all three match. In the LET version you change the definition of net once, and both the shipping and the total follow automatically.
How to write a LET formula in Excel, step by step
- Click the first result cell, for example G2, and type
=LET(. Excel shows the argument tooltip name1, name_value1, calculation_or_name2. - Type the first name and a comma:
net,. Choose short, descriptive names. They must start with a letter and must not look like a cell address. - Type the value for that name:
B2*C2*(1-D2),. Use relative references here so the formula still works when you copy it down. - Add the next pair, which can use the first name:
ship,IF(net>=$B$14,0,MAX($B$16,net*$B$15)),. Press F4 right after typing B14, B15 and B16 to lock them with dollar signs. - Type the final calculation, close the bracket and press Enter:
net+ship). The cell shows 1,017.12 for AF-3101. - For readability, click into the formula bar and press Alt+Enter (Mac: Option+Return) before each name, so every step sits on its own line. Press Ctrl+Shift+U to expand the formula bar.
- Copy the formula down: double-click the fill handle (the small square at the bottom right of the cell) or select G2:G11 and press Ctrl+D.
- Check one row by hand, for example AF-3110: 2 × 995 × 0.9 = 1,791, above the limit, so the total must be 1,791.00.
=LET(net,B2*C2*(1-D2),ship,IF(…),net) shows you the net value, and swapping the last argument to ship shows the shipping. When each step looks right, put net+ship back.Naming rules that save you from strange errors
- A name must start with a letter and must not contain spaces. Use
net_valueornetValue, notnet value. - A name must not look like a cell reference.
tax1,AB2andR1C1are addresses, so Excel refuses them.taxRateis fine. - Names are not case-sensitive:
Netandnetare the same name inside one LET. - Every name needs a value, and the formula needs a final calculation. If you end with a name/value pair and no calculation, Excel reports an error.
- Avoid names that are also function names, such as
sumormax. Excel may accept some of them, but they confuse the reader. - Keep names short but meaningful.
nis short but says nothing,netValueAfterDiscountBeforeShippingis precise but makes the formula long again.netis the sweet spot.
LET with whole ranges and dynamic arrays
LET is not limited to single values. A name can hold an entire array, as in the free-shipping count above. This is where LET really shines in modern Excel, because dynamic array formulas often need the same filtered or calculated array more than once. For example, =LET(net,B2:B11*C2:C11*(1-D2:D11),AVERAGE(FILTER(net,net<B14))) returns the average net value of the orders that still pay shipping, and =LET(net,B2:B11*C2:C11*(1-D2:D11),SUM(net)-SUM(B2:B11*C2:C11)) returns the total discount given, as a negative number. In both cases the array of net values is built once and reused.
This pattern becomes the backbone of the rest of the course. LAMBDA, BYROW, MAP, SCAN and REDUCE all work on arrays, and LET is how you keep those formulas readable. Once you are comfortable naming arrays, the jump to writing your own functions is much smaller than it looks.

Common mistakes and how to spot them
- Forgetting the final calculation.
=LET(net,B2*C2*(1-D2))has a name and a value but nothing to return. Excel shows an error message as soon as you press Enter. Add the result as the last argument. - Using a name before it is defined. Names are read left to right, so
shipcan usenetonly ifnetcomes first. If you see#NAME?, check the order of the pairs. - Missing dollar signs on the rules. Without
$B$14the copied formula in row 3 points to B15 as the limit. Spot it by clicking a lower row and checking whether the rule references still point to B14:B16. - Applying the discount in the wrong place. Testing
B3*C3>=$B$14uses the gross value, so AF-3102 would wrongly ship free. If an order with a discount ships free while its net value is below the limit, the test uses the wrong name. - Choosing a name that is a cell address.
tax1orvat20look like addresses (column TAX, row 1). Excel rejects the formula. Rename totaxRate. - Sharing with older Excel versions. In Excel 2019 or older a LET formula shows
#NAME?. If the same file shows correct values for you and errors for a colleague, check their version. - Multiplying by 100 when the cell is formatted as %. D2 already stores 0.1 for 10%, so
1-D2is correct and1-D2/100would apply a 0.1% discount instead.
Quick reference: functions and shortcuts used
| Function / key | What it does | Example from this lesson |
|---|---|---|
LET(name1, value1, …, calculation) | Names intermediate results inside one formula. The last argument is the result. | =LET(gross,B2*C2,gross*(1-D2)) |
IF(test, if_true, if_false) | Returns one of two values depending on a condition. | IF(net>=$B$14,0,…) |
MAX(a, b) | Returns the larger value; used here as a minimum charge. | MAX($B$16,net*$B$15) |
SUM(--(condition)) | Turns TRUE/FALSE into 1/0 and adds them up: a count. | SUM(--(net>=B14)) |
F4 | Cycles a reference through $B$14, B$14, $B14, B14. | Lock the shipping rules before copying down. |
Alt+Enter (Mac: Option+Return) | Line break inside the formula bar, so each LET pair can sit on its own line. | One line per name. |
Ctrl+Shift+U | Expands or collapses the formula bar (Windows). | Read a long LET at once. |
F9 (in the formula bar) | Evaluates the selected part of a formula; press Esc to undo. | Check what B2*C2*(1-D2) returns. |
Real-world uses for LET
- Pricing and quoting. A quote calculator that applies volume discounts, a minimum order fee and tax can name each step (
gross,disc,fee,tax) so sales staff can follow the logic when a customer asks how a price was built. - Commission and bonus plans. Tiered commission formulas are notorious for deep nesting. With LET you name the sales amount, the attainment and the rate once, and the final payout reads like the plan document.
- Finance and reporting. Variance formulas often need actual, budget and the difference several times, for example to show a percentage and a flag. LET calculates the difference once and returns a clean result.
- Data cleaning. A formula that trims, cleans and splits a text value can name the cleaned text first and then extract parts of it, instead of repeating
TRIM(CLEAN(A2))four times. - Dashboards with dynamic arrays. A filtered list that feeds both a count and an average can be defined once with FILTER inside LET, which keeps large dashboards responsive.
What you will build in the rest of this course
Lesson 1 gives you the habit of naming steps. The remaining 19 labs turn that habit into your own toolbox of functions, all with Alder & Finch data and instant feedback on every formula.
LAMBDA Basics: Parameters, a Calculation and Calling It Inline. You write your first custom functions for the catalogue, such as converting inches to centimetres, footprint, volume and a shipping class, and call them directly in the cell, including from a LET variable. You will see that a LAMBDA is just a LET whose inputs are left open.
Named LAMBDAs: TaxPrice, MarginPct and Your Own Workbook Functions. You use custom functions like TaxPrice, MarginPct and Discounted exactly like built-in functions, nest them, and test a new Markup function inline before it gets a name. This is where colleagues start asking how you did it.
BYROW and BYCOL: One Formula for Every Row or Column. You summarise half a year of store sales with a single spilling formula per question: total and range per store, total per month and the number of stores that hit the target.
MAP: Your Own Logic for Every Element, Even with AND and OR. You set shelf prices, flag reorders with category-specific limits and pick homepage items with AND, then total the featured stock value with SUM(MAP()). You also learn why plain AND and OR do not work element by element, and how MAP fixes that.
REDUCE and SCAN: Running Totals, Compounding and Final Balances. You build year-to-date sales with SCAN, grow a cash reserve with monthly interest, get the year-end balance with REDUCE and chart the running total, without a single helper column.
MAKEARRAY: Multiplication Tables, Rotas and Payment Schedules. You generate three complete grids from nothing but a row and a column number: a crate by pack-size table, a weekly showroom rota and an instalment plan.
Mid-course project: Refactor a Nested Commission Formula into LET and LAMBDA. You take a real-looking, unreadable commission formula, rewrite it with LET, test a flat IFS version as an inline LAMBDA and total the whole plan with MAP and a named Commission function, proving at every step that the results stay identical. It is exactly the kind of clean-up you can then repeat in your own workbooks.
Summary
LET gives names to the steps of a calculation inside one formula. You write name/value pairs and finish with the calculation that the cell returns. Each value is calculated once, later names can use earlier ones, and the result is a formula that reads like a recipe instead of a puzzle. For Alder & Finch that means one definition of the net value that feeds the shipping charge, the order total and even a count over all ten orders.
The best way to make it stick is to type it yourself. Scroll up to the lab, fill E2:E11 with the gross formula, build the shipping and total columns with net and ship, and let the Coach check your count in B18. It takes about a quarter of an hour, and you will never look at a long nested formula the same way again.
Frequently asked questions
What does the LET function do in Excel?
LET assigns names to intermediate results inside a single formula. You write name and value pairs, and the last argument is the calculation the cell returns, for example =LET(gross,B2*C2,gross*(1-D2)).
Does LET make Excel formulas faster?
It can. Each named value is calculated only once, even if the name is used several times, so a formula that used to repeat an expensive expression does less work.
Which Excel versions support LET?
LET works in Excel for Microsoft 365, Excel 2021 and later, Excel for the web and current Excel for Mac. Older versions such as Excel 2019 show a #NAME? error.
What names can I use inside LET?
A name must start with a letter, contain no spaces and must not look like a cell reference, so tax1 or AB2 are not allowed. Short descriptive names such as net, ship or taxRate work well.
Can a LET variable hold a whole range or array?
Yes. A name can hold an array such as B2:B11*C2:C11, and you can then filter, count or sum it, for example =LET(net,B2:B11*C2:C11,SUM(--(net>=1500))).
What is the difference between LET and LAMBDA?
LET names values that are fixed inside one formula. LAMBDA creates a reusable function with parameters that you can call with different inputs or save under a name in the Name Manager.
Keep going: Excel LET & LAMBDA: Readable Formulas, Custom Functions & MAP/REDUCE
This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time $9.90.
- LAMBDA Basics: Parameters, a Calculation and Calling It Inline
- Named LAMBDAs: TaxPrice, MarginPct and Your Own Workbook Functions
- BYROW and BYCOL: One Formula for Every Row or Column
- MAP: Your Own Logic for Every Element, Even with AND and OR
- REDUCE and SCAN: Running Totals, Compounding and Final Balances
- MAKEARRAY: Multiplication Tables, Rotas and Payment Schedules
- Mid-course project: Refactor a Nested Commission Formula into LET and LAMBDA
- Debugging LET: Return Each Step, Find the Broken Name and Avoid Collapsing MAX
- Robust LAMBDAs: Guard Against Blanks, Zeros and Text Like "n/a"
- A Named LAMBDA Library for Invoices: DueDate, DaysLate and AgeBucket Working Together
- BYROW with Lookups and TAKE: Best Month, Quarter Growth and Row Status
- MAP for Text: Clean Supplier Codes, Split Them and Build Shop SKUs
- SCAN Beyond Sums: Stock Balances, a Floor at Zero and Week-to-Date Resets
- REDUCE with a Rule Table: Replace Codes Step by Step and Chain Discounts
- LAMBDAs as Arguments: Pick the Summary Rule from a Cell and Reuse a Trimmed Mean
- MAKEARRAY Sensitivity Grid: Profit for Every Price and Volume, with Bulk Costs
- A Loan Schedule with SCAN, VSTACK and DROP: Balance, Interest and Principal
- Category Summaries with MAP: Revenue, Margin and the Top Region per Category
- Final Project: The Alder & Finch Year Dashboard Built with MAP, LET and Named LAMBDAs