Category: FUNCTION | Updated: 2026-11-22

How to Use the COLUMNS Function in Google Sheets | Count the Number of Columns in a Range

How to Use the COLUMNS Function

The COLUMNS function returns the number of columns (horizontal cell count) in a specified cell range or array as a number. It is useful for counting table fields, generating horizontal sequential numbers, and building dynamic references.

Syntax

=COLUMNS(range)
  • range: The cell range (e.g., B1:G1) or array (e.g., {1, 2, 3, 4}) whose column count you want to find (required).

Example Using a Table

Here is an example of getting the number of months covered (columns B through G) in the six-month budget table below.

Row Column A Column B Column C Column D Column E Column F Column G
1 Item Apr May Jun Jul Aug Sep
2 Ad Spend 100,000 120,000 110,000 130,000 150,000 140,000
  • Formula: =COLUMNS(B1:G1)
  • Result: 6 (returns a total of 6 columns from Column B through Column G)

You can also combine it like =SUM(B2:G2) / COLUMNS(B1:G1) to automatically calculate the monthly average even when columns are added or removed.

Common Errors and Notes

  • Returns the Column Count Regardless of Blank Cells: COLUMNS returns the horizontal width (column count) of the specified range regardless of whether cells contain data. To count only columns with values, use COUNTA.
  • Do Not Confuse with Singular COLUMN: COLUMNS (with an S) returns the count (width) of columns, while COLUMN (without an S) returns the column position from the left. COLUMNS(C1:E1) and COLUMN(C1:E1) both happen to return 3 (the position of Column C), but their meanings are different.
  • Argument Cannot Be Omitted: Entering =COLUMNS() with no argument produces an error. Always specify a range or array.

Frequently Asked Questions

Q. What is the difference between COLUMNS and COLUMN?

A. COLUMN returns the column position of a specified cell (1 for Column A, 3 for Column C), whereas COLUMNS returns the total number of columns included in a specified range (e.g., 4 columns for Columns B through E).

Q. Can I use the COLUMNS function to create horizontal sequential numbers?

A. Yes, you can. For example, entering "=COLUMNS($B$1:B1)" in cell B1 and dragging it to the right expands the range by one column at a time, generating horizontal sequential numbers "1, 2, 3, 4..." automatically.