Logical

BYROW Function in Excel

Applies a LAMBDA to each row and returns an array of results.

Syntax

  • =BYROW(array, lambda)

Arguments

  • array (required): Array to process
  • lambda (required): LAMBDA to apply to each row

Examples

  • =BYROW(A1:C5, LAMBDA(row, SUM(row))) - Sum each row - Result: Row sums

Excel BYROW function documentation

  • BYROW applies a LAMBDA to each row of an array and returns a column of results.
  • Syntax: =BYROW(array, LAMBDA(row, calculation)). Microsoft 365.
  • Ideal for row-wise custom metrics without helper columns copied down thousands of lines.
  • Related: [BYCOL](/functions/bycol/), [MAP](/functions/map/), [REDUCE](/functions/reduce/), [SCAN](/functions/scan/).

BYROW syntax

  • array: 2D range — each row vector passed to LAMBDA.
  • Result spills vertically — one result per row.
  • LAMBDA parameter name arbitrary: LAMBDA(r, SUM(r)) etc.
  • Combine with LET for reusable subexpressions inside lambda.

Step-by-step: row-wise max minus min

  • Step 1 — Scores across columns A2:E500.
  • Step 2 — =BYROW(A2:E500, LAMBDA(r, MAX(r)-MIN(r))).
  • Step 3 — Spills column of ranges next to table.
  • Step 4 — Compare helper =MAX(A2:E2)-MIN(A2:E2) copied down.
  • Step 5 — BYROW wins when table width changes often.

BYROW vs apply row formula vs Power Query

  • BYROW — live formula column spill.
  • Fill down — static after copy unless table structured refs.
  • Power Query — ETL scale transforms.
  • Read [LET guide](/blog/excel-let-function-cleaner-formulas-guide/) first.

Worked examples to copy

  • Row sum: =BYROW(A2:D100, LAMBDA(r, SUM(r))).
  • All positive? =BYROW(rng, LAMBDA(r, MIN(r)>=0)).
  • Text join row: =BYROW(A2:C2, LAMBDA(r, TEXTJOIN(", ", TRUE, r))).
  • Custom score: =BYROW(scores, LAMBDA(r, SUM(r)/COUNT(r))).

People also ask

  • BYROW Excel 2019? — No; 365.
  • BYROW slow? — Large arrays expensive — bound table.
  • BYROW #SPILL!? — Clear cells below formula.
  • BYROW vs MAP? — BYROW is row-specific; MAP is element-wise.

Common errors

  • Requires Excel 365
  • LAMBDA receives entire row

Use cases

  • Row calculations
  • Custom row aggregations
  • Array processing

Frequently asked questions

  • What is BYROW and when should I use it? BYROW applies a function to each row of an array, returning one result per row. Use it when you need custom row calculations that standard functions don't provide, like finding the second-largest value in each row or complex conditional logic.
  • How is BYROW different from MAP? MAP processes each individual cell. BYROW processes entire rows at once. Use MAP for cell-by-cell operations (like doubling each value). Use BYROW when you need to aggregate or analyze across columns within each row.
  • How do I find the second largest value in each row? Use =BYROW(A1:E10, LAMBDA(row, LARGE(row, 2))). The LAMBDA receives each row as an array, and LARGE finds the 2nd largest. This would be complex without BYROW - you'd need helper columns or complex formulas.

Editorial review

  • Reviewed by Excel.Directory Editorial Team. Updated May 2026.

When to use BYROW

  • Row calculations — common Logical scenario for BYROW.
  • Custom row aggregations — common Logical scenario for BYROW.
  • Array processing — common Logical scenario for BYROW.

BYROW in the Logical category

  • Browse all Logical functions at /categories/logical/ for related formulas.
  • BYROW syntax: =BYROW(array, lambda)
  • array (required): Array to process
  • lambda (required): LAMBDA to apply to each row
  • Confirm BYROW arguments match the syntax shown above before filling down.
  • Lock table and range references with $ when copying formulas across rows or sheets.

Formula checklist before you copy down

  • Confirm BYROW arguments match the syntax shown above before filling down.
  • Lock table and range references with $ when copying formulas across rows or sheets.
  • If results look wrong, check for text stored as numbers and invisible spaces with TRIM.
  • Spot-check three known input rows manually against expected output.

Related Excel functions

  • BYCOL (/functions/bycol/): Applies a LAMBDA to each column and returns an array of results.
  • MAP (/functions/map/): Returns an array formed by mapping each value in the array(s) to a new value using a LAMBDA.
  • LAMBDA (/functions/lambda/): Creates custom, reusable functions that can be called by a friendly name.

Errors to watch for

  • Requires Excel 365 — review causes on linked error pages in the directory.
  • LAMBDA receives entire row — review causes on linked error pages in the directory.

Copy-paste audit workflow

  • Enter BYROW on three test rows with known expected output documented on a QA tab.
  • Fill down only after absolute references are locked on lookup tables and rate tables.
  • Compare against manual calculation or a calculator for financial and statistical functions.
  • Search this directory for comparison guides when choosing between similar functions in the same category.

BYROW worked examples to copy

  • =BYROW(A1:C5, LAMBDA(row, SUM(row))) — Sum each row. Expected result: Row sums.

BYROW reference summary for crawlers and offline review

  • BYROW belongs to the Logical category in Excel. Applies a LAMBDA to each row and returns an array of results.
  • Full syntax: =BYROW(array, lambda). Open /functions/byrow/ for parameters, FAQs, and related pages.
  • Common mistakes: Requires Excel 365; LAMBDA receives entire row
  • Pair this function with comparison guides when another Excel formula might fit the same task better.
  • Review fix-excel-formula-errors when unexpected errors appear after upgrading Excel or sharing across locales.