Summary

The Excel COLUMNS function returns the count of columns in a given reference. For example, COLUMNS(A1:C3) returns 3, since the range A1:C3 contains 3 columns.

Purpose 

Get the number of columns in an array or reference.

Return value 

Number of columns

Syntax

=COLUMNS(array)
  • array - A reference to a range of cells.

How to use 

The COLUMNS function returns the count of columns in a given reference as a number. For example, COLUMNS(A1:C3) returns 3, since the range A1:C3 contains 3 columns. COLUMNS takes just one argument, called array, which should be a range or array.

Examples

Use the COLUMNS function to get the column count for a given reference or range. For example, there are 6 columns in the range A1:F1 so the formula below returns 6:

=COLUMNS(A1:F1) // returns 6

The range A1:Z100 contains 26 columns, so the formula below returns 100: 

=COLUMNS(A1:Z100) // returns 26

You can also use the COLUMNS function to get a column count for an array constant:

=COLUMNS({1,2,3,4,5}) // returns 5

Although there is no built-in function to count the number of cells in a range, you can use the COLUMNS function together with the ROWS function like this:

=COLUMNS(range)*ROWS(range) // total cells
=COLUMNS(A1:Z100)*ROWS(A1:Z100) // returns 2600

More details here.

Notes

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.