π― What You'll Learn
- Explain what BYROW does and how it replaces dragging formulas down
- Write BYROW + LAMBDA formulas from scratch on any data range
- Use INDEX(row, 1, N) to pick specific columns inside a LAMBDA
- Apply LET inside LAMBDA to write clean, readable row formulas
- Identify the #CALC! error and know exactly how to avoid it
π Before You Begin
- Comfortable entering basic formulas (SUM, IF, VLOOKUP)
- Familiar with what a cell range like B2:E21 means
- Using Excel 365 / Excel 2021+ or Google Sheets (older Excel won't work)
- No programming experience needed β LAMBDA is explained from scratch
The Big Idea β What BYROW Actually Does
Imagine you're a factory quality inspector. Instead of walking the entire floor at once, you go row by row β checking each row on the assembly line, recording your result, then moving to the next. That's exactly what BYROW does with your spreadsheet data.
e.g. B2:E21
row by row
your formula once
per row, instantly
The Data Table We'll Use
All 12 examples in this article use this sales table. Keep it open in another tab as a reference:
| A Β· Rep | B Β· Region | C Β· Units | D Β· Price | E Β· Returns | |
|---|---|---|---|---|---|
| Row 1 | Alice | North | 150 | 20 | 5 |
| Row 2 | Bob | South | 80 | 50 | 12 |
| Row 3 | Charlie | East | 200 | 15 | 2 |
The Core Syntax β Decoded
Every BYROW formula has the same two-part structure. Read the formula like a sentence:
BYROW(range, β¦)
You give BYROW a rectangular range. It will visit each row one at a time, like flipping through pages in a book.
LAMBDA(row, β¦)
LAMBDA defines what to do with each row. The name row is just a label you invent β you could use any name you like.
INDEX(row, 1, N)
INDEX picks the Nth column from the current row slice. This is how you say "give me the Units column" or "give me the Price column."
/* Example 1: Total Revenue = Units Γ Price */
=BYROW(C1:D3, LAMBDA(row,
INDEX(row,1,1) * INDEX(row,1,2)
))
Alice β 150 Γ 20 = 3000 Bob β 80 Γ 50 = 4000 Charlie β 200 Γ 15 = 3000
INDEX Inside LAMBDA β The Relative Rule
This is the rule that trips everyone up at first. INDEX counts from the left edge of YOUR selection β not from column A of the sheet.
If selection is C1:D3 |
If selection is B1:E3 |
|
|---|---|---|
| 1 | Column C (Units) | Column B (Region) |
| 2 | Column D (Price) | Column C (Units) |
| 3 | Out of range! | Column D (Price) |
| 4 | Out of range! | Column E (Returns) |
12 Live Examples
Click any example to see the formula and how it works. Each one uses a slightly different part of the dynamic array toolkit.
=BYROW(C1:D3, LAMBDA(r, INDEX(r,1,1) * INDEX(r,1,2)))
Multiplies Units Γ Price for each row. Alice: 150Γ20 = 3,000. Bob: 80Γ50 = 4,000. Charlie: 200Γ15 = 3,000.
=BYROW(C1:E3, LAMBDA(r, INDEX(r,1,1) - INDEX(r,1,3)))
Notice we skip column 2 (Price) entirely. INDEX(r,1,3) jumps straight to the 3rd column of the selection β Returns. Alice: 150β5 = 145. Bob: 80β12 = 68.
=BYROW(C1:D3, LAMBDA(r, (INDEX(r,1,1)*INDEX(r,1,2)) * 0.1))
Calculates Revenue first, then multiplies by 0.1. Alice: 3000Γ0.1 = 300. Bob: 4000Γ0.1 = 400.
=BYROW(C1:C3, LAMBDA(r, IF(INDEX(r,1,1) > 100, "Goal Met", "Low")))
Since we only selected column C, there's only one column β INDEX(r,1,1) = Units. Returns: Alice β Goal Met, Bob β Low, Charlie β Goal Met.
=BYROW(C1:E3, LAMBDA(r, INDEX(r,1,3) / INDEX(r,1,1)))
Divides Returns by Units. Bob has the highest return rate: 12Γ·80 = 15%. Alice: 5Γ·150 = 3.3%.
=BYROW(D1:D3, LAMBDA(r, IF(INDEX(r,1,1) > 25, "Premium", "Budget")))
Only column D is selected. Alice (Price=20) β Budget. Bob (Price=50) β Premium. Charlie (Price=15) β Budget.
=BYROW(C1:D3, LAMBDA(r, (INDEX(r,1,1)*INDEX(r,1,2)) * 0.05))
Same as commission but at 5%. Alice: 3000Γ0.05 = 150. Bob: 4000Γ0.05 = 200.
=BYROW(B1:B3, LAMBDA(r, LEFT(INDEX(r,1,1), 1)))
Extracts just the first character: North β N, South β S, East β E. Useful for creating short codes or category flags.
=BYROW(C1:E3, LAMBDA(r, (INDEX(r,1,1)-INDEX(r,1,3)) * INDEX(r,1,2)))
The most realistic revenue calc: subtract returns first, then multiply by price. Alice: (150β5)Γ20 = 2,900. Bob: (80β12)Γ50 = 3,400.
=BYROW(C1:C3, LAMBDA(r, IF(INDEX(r,1,1)>150, 500, 0)))
Alice (150) does NOT exceed 150 β 0. Charlie (200) exceeds β 500. Bob (80) β 0. Note: strictly greater than, so 150 itself earns nothing.
=BYROW(C1:E3, LAMBDA(r, IF(INDEX(r,1,3) > (INDEX(r,1,1)*0.1), "Review", "OK")))
Checks if Returns > 10% of Units. Bob: 12 > 8? β Review. Alice: 5 > 15? β OK. Charlie: 2 > 20? β OK.
=BYROW(B1:C3, LAMBDA(r, INDEX(r,1,1) & "-" & INDEX(r,1,2)))
The & operator joins text. Alice: "North-150". Bob: "South-80". Great for creating unique identifiers or display labels.
LET + LAMBDA β Cleaner, Readable Formulas
Once your formulas have 3+ INDEX calls, they become hard to read. LET solves this by giving names to each column β like labelling boxes before you use them.
=BYROW(C1:E3, LAMBDA(row,
LET(
u, INDEX(row,1,1),
p, INDEX(row,1,2),
r, INDEX(row,1,3),
(u - r) * p
)
))
u = Units, p = Price, r = Returns
Formula now reads like: Net Revenue = (Units β Returns) Γ Price
Name your columns
Give each INDEX call a short name inside LET. Use u, p, r β or full words like units.
Reuse without repeating
Need Units twice? With LET, write u twice. Without LET, write the full INDEX call twice.
Easier to debug
When something breaks, readable names make it immediately obvious which column is wrong.
The #CALC! Trap
BYROW has one strict rule: every row must produce exactly one value. If your LAMBDA tries to return two or more values from a single row, you get a #CALC! error.
This works
Each row β one number, one text, one TRUE/FALSE. One answer = no problem.
This breaks
Trying to return Units AND Price in one row? BYROW can't handle two-column output. It throws #CALC!.
Quiz β Test Yourself
Five questions. Each one tests whether you can apply the BYROW pattern, not just remember it.
You select the range D1:E3 for BYROW. What does INDEX(r, 1, 2) refer to?
Which formula correctly calculates commission (10% of Units Γ Price) using range C1:D3?
What error will you get if your LAMBDA tries to return both Units and Price as two separate values in one row?
You want to label rows as "Alert" if Returns > 10% of Units. Range is C1:E3. Which formula is correct?
What is the main advantage of using LET inside LAMBDA in a BYROW formula?
π‘ Key Takeaways
- BYROW loops your formula row by row β one formula replaces dragging down 1,000 cells.
- The Relative Rule β INDEX(r,1,N) counts from the left edge of YOUR selection, not from column A.
- LAMBDA names your row β the variable (e.g.
row) represents one horizontal slice at a time. - LET makes it readable β name each INDEX call once, use the name as many times as needed.
- One output per row, always β trying to return two values causes #CALC!. Use two separate BYROW formulas instead.