# COLUMNS in Google Sheets: syntax and examples

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

COLUMNS counts the columns in a range or array. It returns a size, not a position. Use it to size formulas that must follow a table as it grows, for example as the index in VLOOKUP or INDEX.

## Syntax

```
COLUMNS(range)
```

## Arguments

- `range` (range, required: yes): The range or array to count columns in.

## Examples

The examples use this table, starting in A1:

| a | b | c | d |
|---|---|---|---|
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |

```
=COLUMNS(A1:D3)
```

Result: `4`

A block four columns wide. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=COLUMNS(B:C)
```

Result: `2`

Whole columns count too: B and C make two. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=COLUMNS(C2)
```

Result: `1`

One cell is one column, not the number 3. COLUMN would return 3. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=COLUMNS({1, 2, 3})
```

Result: `3`

An inline array with three values in a row. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=INDEX(A2:D3, 2, COLUMNS(A2:D3))
```

Result: `8`

The last column of row 2, without hard-coding 4. Run in a Google Sheet (English US locale) on 2026-11-29.

## Common errors

- COLUMNS counts, COLUMN gives a position. COLUMNS(C2) is 1, while COLUMN(C2) is 3.
- It takes exactly one argument. A second one returns #N/A.
- A whole-column reference such as B:C counts every column in it.
- In a locale that uses ";" and "\", an inline array written with commas returns #ERROR!.

## Compared with Excel

Same syntax in Excel.

## Related functions

- [COLUMN](https://goingstellar.ro/reference/sheets/column/)
- [ROW](https://goingstellar.ro/reference/sheets/row/)
- [ROWS](https://goingstellar.ro/reference/sheets/rows/)
- [INDEX](https://goingstellar.ro/reference/sheets/index/)
- [HLOOKUP](https://goingstellar.ro/reference/sheets/hlookup/)
- [VLOOKUP](https://goingstellar.ro/reference/sheets/vlookup/)

## Sources

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

