Formualizer Docs

COLUMNS

Returns the number of columns in a reference or array.

COLUMNS reports width, not data density.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=COLUMNS(array)

Arguments

ArgumentTypeRequiredDefault
arrayany (range)Required—

Remarks

  • For a single cell reference, returns 1.
  • For full-row references (for example 1:1), returns 16384.
  • For array literals, returns the first row width.
  • Invalid references return an error.

Examples

Count the corresponding dimension of a rectangular array.

Formula =COLUMNS({1,2,3;4,5,6})

Expected result 3

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Count the dimension when the array has one column and three rows.

Formula =COLUMNS({1;2;3})

Expected result 1

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

The smallest array has one row and one column.

Formula =COLUMNS({42})

Expected result 1

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Count columns in a rectangular range

Formula =COLUMNS(B2:D10)

Expected result 3

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Count columns in a full row reference

Formula =COLUMNS(1:1)

Expected result 16384

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

Does COLUMNS count non-empty cells?

No. COLUMNS returns the width of the referenced array/range, including blank cells.

What does COLUMNS return for a full-row reference like 1:1?

It returns the sheet column limit, 16384.

Implementation

Engine source

On this page