Logical function

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))
ArgumentWhat it means
arrayRequiredThe range or array whose rows you want to process.
lambdaRequiredA 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

E2fx=BYROW(B2:D4, LAMBDA(r, SUM(r)))
ABCDE
1RepQ1Q2Q3
2Ana12151138
3Ben9141841
4Cleo2081341

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

F2fx=BYROW(B2:D4, LAMBDA(r, MAX(r)))
ABCDEF
1RepQ1Q2Q3
2Ana12151115
3Ben9141818
4Cleo2081320

MAX returns the highest value in each row: 15, 18 and 20.

3Flag reps with a weak quarter

G2fx=BYROW(B2:D4, LAMBDA(r, IF(MIN(r)>=10, "Consistent", "Check")))
ABCDEFG
1RepQ1Q2Q3
2Ana121511Consistent
3Ben91418Check
4Cleo20813Check

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.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 16 KB

Common errors and how to fix them

ErrorWhy it happensFix
#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.