Array

BYROW Formula

Applies a LAMBDA function to each row of an array and returns a single-column array of results. BYROW processes one entire row at a time, making it ideal for row-level aggregations like row sums, row averages, or custom per-row calculations that go beyond what simple column formulas can do.

Syntax

BYROW(array, lambda)
ParameterDescription
array Parameter of the BYROW function.
lambda Parameter of the BYROW function.
Try BYROW in Viztab — free, no signup

Examples

Sum each row

Formula
=BYROW(A1:D10, LAMBDA(row, SUM(row)))
Returns a 10-row column where each value is the sum of the corresponding row in A1:D10. Row 1 result = A1+B1+C1+D1.

Max minus min per row

Formula
=BYROW(B2:F20, LAMBDA(r, MAX(r)-MIN(r)))
Returns the range (spread) of each row — the difference between the largest and smallest value in that row.

Count non-blank cells per row

Formula
=BYROW(A1:E50, LAMBDA(r, COUNTA(r)))
Returns how many non-empty cells are in each row. Useful for checking data completeness across multiple columns.

Common Errors

#VALUE!

The LAMBDA doesn't accept exactly 1 parameter, or it returns more than one value (BYROW expects a single result per row).

#CALC!

The LAMBDA produces an error for one or more rows.

Tips

LAMBDA must return a single value

Your LAMBDA function must reduce each row to one value (a number, text, etc.). If it returns an array, you get a #VALUE! error.

BYROW vs BYCOL

BYROW iterates over rows and returns a column; BYCOL iterates over columns and returns a row. Choose based on the axis of aggregation.

Complex per-row logic

Use BYROW for logic that considers multiple columns together: =BYROW(data, LAMBDA(r, IF(INDEX(r,1)>INDEX(r,2), "Over", "Under"))) compares columns within each row.

Try BYROW in Viztab

Import your data and use BYROW with 370+ other formulas. No signup required.

Open Viztab

Related Formulas