Lookup
COLUMNS
Definition
COLUMNS returns how many columns are in a range.
Syntax
=COLUMNS(array)
Arguments
| Argument | Meaning |
|---|---|
array |
The range whose width to count, such as A3:E3. |
Worked example
A header row occupies A3:E3. The first and last cells are filled; the cells between them may be empty.
| A | B | C | D | E |
|---|---|---|---|---|
| start | end |
Formula: =COLUMNS(A3:E3)
Result: 5. A3:E3 is five columns wide, including the empty cells.
Practice
Cells A2 and D2 hold 1. In E2, write a formula that returns how many columns are in A2:D2.
- In E2, write a COLUMNS formula for A2:D2.
- E2 should show how many columns are in A2:D2.
Step 1 of 2
Enter =COLUMNS(A2:D2) in E2.
A2:D2 has 4 columns.
Formulas here use English function names, such as SUM, and a period as the decimal separator, in every language.
Loading the sheet…
E2 uses COLUMNS.
E2 now shows 4.
Related functions
ROWS is the matching height. COUNT counts numeric cells, which can be fewer than the columns in the range.
Common mistake
Expecting COLUMNS to skip blanks: COLUMNS(A2:D2) is 4 even when B2 and C2 are empty.