Standard Excel functions like SUM, MAX, and AVERAGE collapse an entire 2D table into a single number instead of returning one total per row or per column—forcing you to write one formula and drag it down or across. With BYROW in Excel and its vertical partner BYCOL, you can apply any custom LAMBDA calculation across every row or column of a matrix using a single spilling formula.
Availability & Compatibility: Per the official BYROW function documentation and BYCOL function documentation, both functions are available in Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel for the web, Excel 2024, and Excel 2024 for Mac (plus Google Sheets). Older perpetual builds such as Excel 2021 and Excel 2019 do not support them and will display #NAME?.
Table of Contents
How BYROW in Excel Works (Row-by-Row LAMBDA)
BYROW splits a 2D range into individual horizontal rows, passes each row into a LAMBDA function, and spills a single vertical column of results. Here is the syntax:
=BYROW(array, LAMBDA(row, calculation))
- array (Required): The 2D range or dynamic array whose rows you want to evaluate.
- lambda (Required): A LAMBDA function in Excel that accepts one parameter (representing a single row) and returns exactly one scalar result per row.
Suppose your Practice sheet tracks 2026 quarterly unit sales for five hardware products in B6:E10 (Q1 through Q4). Instead of dragging =MAX(B6:E6) down five rows, enter one BYROW formula in G6 to spill every product’s peak quarter:
=BYROW(B6:E10, LAMBDA(r, MAX(r)))
Want each product’s annual total in H6 without helper formulas? Swap MAX(r) for SUM(r):
=BYROW(B6:E10, LAMBDA(r, SUM(r)))
How BYCOL Works (Column-by-Column LAMBDA)
BYCOL mirrors BYROW vertically: it slices a 2D array into individual columns, passes each column into your LAMBDA, and spills a single horizontal row of results:
=BYCOL(array, LAMBDA(column, calculation))
To calculate total units sold across all five products for Q1, Q2, Q3, and Q4 in one formula in B12, enter:
=BYCOL(B6:E10, LAMBDA(col, SUM(col)))
You can also combine the LET function in Excel inside your LAMBDA to name intermediate row or column metrics—for example, computing each quarter’s share of annual sales or counting how many products exceeded 400 units in a quarter with =BYCOL(B6:E10, LAMBDA(col, SUM(--(col>400)))).
BYROW vs. BYCOL vs. Dragged Formulas
Use this quick comparison to see when BYROW and BYCOL outperform traditional copied formulas:
| Method | Output Shape | Auto-Expands With Dynamic Arrays? | Compatibility | Best For |
|---|---|---|---|---|
| BYROW | 1 column × N rows | Yes | M365, Excel 2024, Sheets | Row totals, peaks, pass/fail flags |
| BYCOL | N columns × 1 row | Yes | M365, Excel 2024, Sheets | Column totals, quarterly KPIs |
| Dragged SUM/MAX | 1 cell per copy | No (manual drag) | All Excel versions | Legacy Excel 2021/2019 sharing |
Troubleshooting #CALC!, #VALUE!, and #SPILL! Errors
- #CALC! error: Per Microsoft Support,
BYROWandBYCOLreturn#CALC!if you omit theLAMBDAfunction or if yourLAMBDAreturns more than one value per row or column (for instance, returning a multi-cell array instead of a single aggregated scalar). - #VALUE! error (“Incorrect Parameters”): Returned when the
LAMBDAdefines zero parameters or more than one parameter. BothBYROWandBYCOLrequire a single-parameterLAMBDA. - #SPILL! error: Clear any text, totals, or merged cells in the vertical or horizontal spill path—see our guide on how to fix the #SPILL! error in Excel.
- #NAME? error: The workbook was opened in Excel 2021 or older, where
BYROWandBYCOLare unavailable.
Frequently Asked Questions
What is the difference between BYROW and BYCOL in Excel?
BYROW applies a LAMBDA calculation to each row of an array and spills a vertical column of results, while BYCOL applies a LAMBDA to each column and spills a horizontal row of results.
Why do BYROW and BYCOL return a #CALC! error?
Excel returns #CALC! when the LAMBDA inside BYROW or BYCOL returns a multi-cell array instead of a single value for each row or column, or when no LAMBDA is provided.
How many parameters should the LAMBDA inside BYROW have?
Exactly one parameter representing the current row (in BYROW) or current column (in BYCOL). Providing zero or two parameters triggers a #VALUE! error.
Can I use BYROW on a dynamic array like FILTER or SORT?
Yes. Passing a dynamic array expression such as FILTER(…) into BYROW lets the row-by-row summary automatically grow and shrink as the filtered rows change.
Do BYROW and BYCOL work in Google Sheets and Excel 2021?
Both functions work in Google Sheets, Excel for Microsoft 365, and Excel 2024. They are not supported in Excel 2021 or earlier perpetual versions.
Download the practice workbook
The same data as this tutorial, with empty answer cells and a Solutions sheet.