BYROW function
Runs a LAMBDA on each row of a range and returns one result per row, such as a total or a status for every employee.
Available in Microsoft 365, Excel 2024, Excel for the web, Excel for Mac 2024
Excel 2024 and laterWorks in Google Sheets
Syntax
BYROW(array, lambda(row))| Argument | What it means | |
|---|---|---|
array | Required | The range or array whose rows you want to process. |
lambda | Required | A LAMBDA with one parameter. Each row is passed to it; it must return one value. |
Returns: A one-column array with one value per row, which spills downwards.
How BYROW works
BYROW applies the same calculation to every row of a table and spills the answers down a column. Totals per salesperson, the best quarter per product, or a status label that depends on several cells in the row can all be produced by one formula at the top, rather than a formula copied into every row.
Inside the LAMBDA you work with a single row as if it were a small range: LAMBDA(r, SUM(r)) totals it, LAMBDA(r, MIN(r)>=10) tests it. The calculation must reduce the row to one value — returning several values per row gives #CALC!. One clear benefit over copied formulas: if the source is a dynamic array (for example a FILTER result), BYROW automatically produces the right number of answers.
Examples
1Total units per sales rep
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Rep | Q1 | Q2 | Q3 | |
| 2 | Ana | 12 | 15 | 11 | 38 |
| 3 | Ben | 9 | 14 | 18 | 41 |
| 4 | Cleo | 20 | 8 | 13 | 41 |
Each row of quarters is summed: Ana 12+15+11 = 38, Ben 41, Cleo 41. The three results spill from E2 to E4.
2Best quarter for each rep
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Rep | Q1 | Q2 | Q3 | ||
| 2 | Ana | 12 | 15 | 11 | 15 | |
| 3 | Ben | 9 | 14 | 18 | 18 | |
| 4 | Cleo | 20 | 8 | 13 | 20 |
MAX returns the highest value in each row: 15, 18 and 20.
3Flag reps with a weak quarter
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Rep | Q1 | Q2 | Q3 | |||
| 2 | Ana | 12 | 15 | 11 | Consistent | ||
| 3 | Ben | 9 | 14 | 18 | Check | ||
| 4 | Cleo | 20 | 8 | 13 | Check |
If every quarter in the row is at least 10, the rep is Consistent. Ben (9 in Q1) and Cleo (8 in Q2) are flagged Check.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#CALC! | The LAMBDA returns an array for a row instead of a single value. | Wrap the row calculation in a function that returns one value, such as SUM, MAX or TEXTJOIN. |
#VALUE! | The LAMBDA has the wrong number of parameters. | Use exactly one: LAMBDA(r, ...). |
Tips
- In current Microsoft 365 builds
=BYROW(B2:D4, SUM)works as shorthand for the LAMBDA version. - To join text from each row, use
LAMBDA(r, TEXTJOIN(", ", TRUE, r))— handy for building address lines.
Google Sheets
BYROW also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.