Back to functions
Logical2026-11-221 related article

BYCOL Function in Excel

Apply a calculation to each column of an array and return one result per column.

Syntax

BYCOL(array, lambda(column))
Table of Contents

Arguments

array

Required

Input array to process by column.

lambda

Required

Callback with one parameter representing the current column; must return a single result.

What it returns

One result per input column in a single output row.

What BYCOL does

BYCOL passes each column of a range to a LAMBDA calculation and returns one result for that column. A range with three columns produces three results in a single output row.

Use it when your report needs a total for each month, department, or other column. BYROW works in the other direction, returning one result for each row.

Practical examples

Total each month's figures

Enter this table in A1:D5. Leave C4 genuinely empty; enter note as text in B5.

PersonJanFebMar
Ada12010080
Ben9080110
Cara10050
Dannote4010

In B8, with B8:D8 clear, enter:

=BYCOL(B2:D5,LAMBDA(values,SUM(values)))
Formula

The expected results spill across B8:D8:

B8: JanC8: FebD8: Mar
310220250

values receives one column at a time. January totals 120 + 90 + 100 = 310; February totals 100 + 80 + 40 = 220; March totals 80 + 110 + 50 + 10 = 250. SUM ignores the referenced text and blank cells.

Add two records in each column

On a separate worksheet, enter this range in B2:C3:

BC
1020
3040

In E2, enter:

=BYCOL(B2:C3,LAMBDA(values,SUM(values)))
Formula

The expected results are 40 in E2 and 60 in F2. The first input column returns 10 + 30, and the second returns 20 + 40. The output runs across a row even though each calculation processes a column.

The row and column totals guide compares these formulas with copied SUM formulas and shows a Table input that expands as you add records.

Common mistakes and notes

Declare one input and return one value

The LAMBDA has one input parameter, values, followed by the calculation SUM(values). An invalid LAMBDA or incorrect parameter count returns #VALUE! (Incorrect Parameters).

Each column's calculation must return a single value. Returning several values for a column produces #CALC!; Microsoft also documents this error when the required LAMBDA is missing.

Leave room to the right

BYCOL spills horizontally. A value in one of the required output cells blocks the result and causes #SPILL!. Put the formula outside an Excel Table, even when its input comes from a Table.

Include new records in the input

B2:D5 is a fixed range. A new record in row 6 is excluded until you extend the reference. Use an appropriate structured Table reference when the source needs to grow, and leave space so added records don't run into the output.

Text handling comes from SUM

In these examples, SUM ignores referenced text and blank cells. A wholly blank column returns 0, but an Excel error in a source cell propagates to that column's result. BYCOL itself doesn't provide an error fallback or make another calculation behave like SUM.

Related functions

Related articles

Deep dives, troubleshooting guides, and practical examples that use BYCOL.

Official documentation