# BYCOL in Google Sheets: syntax and examples

URL: https://goingstellar.ro/reference/sheets/bycol/

BYCOL hands each column of a range to a LAMBDA and collects the results in a single row. It replaces a row of copied formulas with one formula, for column totals, maximums, averages or labels.

## Syntax

```
BYCOL(array_or_range, LAMBDA)
```

## Arguments

- `array_or_range` (range, required: yes): The array or range to split into columns. Each column is passed to the LAMBDA once.
- `LAMBDA` (lambda, required: yes): A LAMBDA with exactly one name. It receives one column and must return one value.

## Examples

The examples use this table, starting in A1:

| Name | Q1 | Q2 | Q3 |
|---|---|---|---|
| Ana | 10 | 20 | 30 |
| Bob | 5 | 15 | 25 |
| Cris | 7 | 8 | 9 |

```
=BYCOL(B2:D4, LAMBDA(c, SUM(c)))
```

Result: 

| 22 | 43 | 64 |
|---|---|---|


Column totals: one number per column, returned as a row. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=BYCOL(B2:D4, LAMBDA(c, MAX(c)))
```

Result: 

| 10 | 20 | 30 |
|---|---|---|


The best score in each quarter. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=BYCOL(B2:D4, LAMBDA(c, AVERAGE(c)))
```

Result: 

| 7.333333333 | 14.33333333 | 21.33333333 |
|---|---|---|


Average per column. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=BYCOL(B2:D4, LAMBDA(c, MAX(c) - MIN(c)))
```

Result: 

| 5 | 12 | 21 |
|---|---|---|


The spread in each quarter: highest minus lowest. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=BYCOL(B2:D4, LAMBDA(c, IF(SUM(c)>30, "high", "low")))
```

Result: 

| low | high | high |
|---|---|---|


A label per column, based on its total. Run in a Google Sheet (English US locale) on 2026-11-29.

## Common errors

- The LAMBDA takes exactly one name, the column. A LAMBDA with two names, as in LAMBDA(c, r, SUM(c)), returns #N/A.
- The second argument must be a LAMBDA. A bare function name such as SUM returns #N/A.
- A text column is not skipped. In A2:D4 the Name column gives 0 for SUM, so start the range at the numbers, as in B2:D4.
- The result is always one row with one cell per column, however many rows the range has.

## Compared with Excel

Same syntax in Excel.

## Related functions

- [BYROW](https://goingstellar.ro/reference/sheets/byrow/)
- [LAMBDA](https://goingstellar.ro/reference/sheets/lambda/)
- [MAP](https://goingstellar.ro/reference/sheets/map/)
- [REDUCE](https://goingstellar.ro/reference/sheets/reduce/)
- [ARRAYFORMULA](https://goingstellar.ro/reference/sheets/arrayformula/)
- [HSTACK](https://goingstellar.ro/reference/sheets/hstack/)

## Sources

- [BYCOL (Docs Editors Help)](https://support.google.com/docs/answer/12571032)

