COLUMNS

Return the number of columns in a range or array.

Syntax

COLUMNS(array)
Argument Required Description
array Required A range or array.

Examples

Every example below was executed against VisiGrid engine 0.54.0 — not transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.

Formula Result Notes
=COLUMNS(A2:D4) 4
=COLUMNS(B1:B1) 1

Width of a table

COLUMNS measures a range, not its contents. It is most useful where a formula needs the width of a table that may grow — the last column of a lookup range, say — so the number does not have to be typed and kept up to date.

As with ROWS, a whole-row reference is bounded to the used area of the sheet rather than the full 16,384 columns.

Excel compatibility

Matches Excel for ranges. Whole-row references such as 1:1 are bounded to the data in the sheet, so COLUMNS(1:1) is the used width, not 16,384.

Related functions

Last updated