Example 1
Total of each row
F2 =BYROW(B2:D5,LAMBDA(r,SUM(r)))
Result: 383; 625; 310; 182
The LAMBDA receives one product's three quarters at a time. Lamp: 120 + 135 + 128 = 383.
F2 =BYROW(B2:D5,LAMBDA(r,SUM(r))) returns 383; 625; 310; 182
Runs a LAMBDA on each row of an array and returns one result per row, as a single column.
Syntax
=BYROW(, )
Excel for Microsoft 365, Excel 2024 and later, and Excel for the web. Not available in Excel 2021 or earlier.
Try it
Edit the formula in F2 or change the inputs. The sheet recalculates as you type.
F2 =BYROW(B2:D5,LAMBDA(r,SUM(r))) returns 383; 625; 310; 182
BYROW takes an array row by row, runs a calculation on each whole row and returns the answers as a column. It is the quick way to get a total, an average, a maximum or a test for every row at once, with one formula.
SUM(r), MAX(r), MIN(r), AVERAGE(r), TEXTJOIN(", ",TRUE,r).=BYROW(B2:D5,LAMBDA(r,SUM(r))) returns the total of each product's three quarters, in four cells spilled down from the formula. The LAMBDA must return one value for each row. If it returns more than one, BYROW returns #CALC!.
Many functions collapse a whole range into one answer, so you can't hand them a table and get one answer per row. Copying a formula down a column is the old method. BYROW does it in one cell and doesn't need filling down as the table grows.
=BYROW(B2:D5,LAMBDA(r,MAX(r)-MIN(r))) gives the spread of each row. =BYROW(B2:D5,LAMBDA(r,SUM(--(r>100)))) counts the quarters above 100 in each row. Comparisons return TRUE and FALSE, and the double minus turns them into 1 and 0.
BYROW's best partner is FILTER. FILTER needs one TRUE or FALSE for each row, and BYROW produces exactly that:
=FILTER(A2:D5,BYROW(B2:D5,LAMBDA(r,MIN(r)>=100)))
This keeps the products for which every quarter reached 100. A row-wise condition such as "all", "none" or "at least two of" is difficult to write any other way.
BYCOL does the same thing for columns. MAP works on each individual cell rather than each row. Pick the function that matches the shape of the question: a number for every row, a number for every column, or a number for every cell.
The result is one column with one cell per row of the input, and it spills. #SPILL! means the cells below the formula aren't empty. To add headers, put them above the formula or stack them: =VSTACK({"Total"},BYROW(...)). See LAMBDA for how to write the function.
BYROW needs Microsoft 365, Excel 2024 or later, or Excel for the web.
B2:D5.LAMBDA(r,SUM(r)).Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
F2 =BYROW(B2:D5,LAMBDA(r,SUM(r)))
Result: 383; 625; 310; 182
The LAMBDA receives one product's three quarters at a time. Lamp: 120 + 135 + 128 = 383.
F2 =BYROW(B2:D5,LAMBDA(r,SUM(r))) returns 383; 625; 310; 182
Example 2
F2 =BYROW(B2:D5,LAMBDA(r,MAX(r)-MIN(r)))
Result: 15; 35; 15; 6
MAX and MIN each look at one whole row. Arm ranges from 190 to 225, a spread of 35.
F2 =BYROW(B2:D5,LAMBDA(r,MAX(r)-MIN(r))) returns 15; 35; 15; 6
Example 3
F2 =BYROW(B2:D5,LAMBDA(r,SUM(--(r>100))))
Result: 3; 3; 2; 0
r>100 gives TRUE or FALSE for each of the three quarters. The double minus turns those into 1 and 0, and SUM adds them.
F2 =BYROW(B2:D5,LAMBDA(r,SUM(--(r>100)))) returns 3; 3; 2; 0
Example 4
F2 =FILTER(A2:D5,BYROW(B2:D5,LAMBDA(r,MIN(r)>=100)))
Result: Lamp, 120, 135, 128; Arm, 210, 190, 225
BYROW gives FILTER one TRUE or FALSE for each product. Hub has a quarter of 95 and Cam of 60, so they are dropped.
F2 =FILTER(A2:D5,BYROW(B2:D5,LAMBDA(r,MIN(r)>=100))) returns Lamp, 120, 135, 128; Arm, 210, 190, 225
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In F2, return the total deals for each rep (the sum of B to D on each row) using BYROW.
Answer in F2.
#CALC!.r>100 is a whole row of TRUE and FALSE values, so wrap it in SUM, AND or OR to get a single answer.-- or *1 before adding.B2:D5.#SPILL! means the cells below the formula are not empty.It runs a LAMBDA on each row of an array and returns one result per row. For example, `=BYROW(B2:D5,LAMBDA(r,SUM(r)))` returns the total of each row in one formula.
Use `=BYROW(B2:D5,LAMBDA(r,SUM(r)))`. It spills one total per row, and it grows when you extend the range.
Pass a BYROW test to FILTER: `=FILTER(A2:D5,BYROW(B2:D5,LAMBDA(r,MIN(r)>=100)))` keeps the rows where every value is at least 100.
BYROW hands the LAMBDA one row at a time and returns a column of answers. BYCOL hands it one column at a time and returns a row of answers.
No. It is available in Microsoft 365, Excel 2024 and later, and Excel for the web. Earlier versions return `#NAME?`.
Tracks take you from the basics to modelling, one graded exercise at a time.