Function · Lookup

Excel COLUMNS function

The Excel COLUMNS function counts the columns in a reference. The five state codes laid across A1:E1 occupy 5 columns.

All current Excel versions. Also in Excel for the web and Google Sheets.

Syntax =COLUMNS(array)

COLUMNS
=COLUMNS(A1:E1)

Arguments

NameRequiredWhat to pass
arrayRequiredThe range or array. Empty columns count.

Examples

How wide the state header is

=COLUMNS(A1:E1)

Result 5

=COLUMNS(A1:E1)A2
States
ABCDE
1CAFLMANYTX
25
A picture of the sheet, not a live calculator.

COLUMNS counts columns. A1:E1 runs from CA through TX, five labels, so the result is 5. An empty column inside the range still counts. The function is the width of the reference, not a count of headers that contain text.

HLOOKUP’s row index is easier to check when COLUMNS of the table matches the width you think you searched. ROW and COLUMN return one coordinate. ROWS and COLUMNS return a size.