Syntax
COLUMNS(array)
| Parameter | Description |
|---|---|
| array | Parameter of the COLUMNS function. |
Examples
Count columns in range
Formula
=COLUMNS(A1:E1)
Returns 5 — the range spans columns A through E.
Measure dynamic array width
Formula
=COLUMNS(FILTER(A1:E10, A1:A10>0))
Returns 5 — FILTER preserves all columns from the source range, so the column count matches the original width.
Auto-expand helper
Formula
=COLUMNS($A$1:A1)
Returns 1 in column A, and when copied right to B1 it returns 2 (because the range becomes $A$1:B1). Creates an auto-incrementing column counter.
Common Errors
#VALUE!
Occurs if the argument is not a valid reference or array.
Tips
Works on arrays
COLUMNS({1,2,3}) returns 3. Useful for measuring in-memory arrays from other formulas.
Combine with ROWS for dimensions
ROWS and COLUMNS together tell you the full dimensions of any range or array. Useful for validation and dynamic formula construction.
Building column counters
=COLUMNS($A$1:A1) is a classic trick for creating an auto-incrementing number when copied horizontally. The anchored start and relative end expand the range.
Try COLUMNS in Viztab
Import your data and use COLUMNS with 370+ other formulas. No signup required.
Open Viztab