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.
| Person | Jan | Feb | Mar |
|---|---|---|---|
| Ada | 120 | 100 | 80 |
| Ben | 90 | 80 | 110 |
| Cara | 100 | 50 | |
| Dan | note | 40 | 10 |
In B8, with B8:D8 clear, enter:
=BYCOL(B2:D5,LAMBDA(values,SUM(values)))FormulaThe expected results spill across B8:D8:
| B8: Jan | C8: Feb | D8: Mar |
|---|---|---|
| 310 | 220 | 250 |
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:
| B | C |
|---|---|
| 10 | 20 |
| 30 | 40 |
In E2, enter:
=BYCOL(B2:C3,LAMBDA(values,SUM(values)))FormulaThe 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.