FormulaCraft

COLUMNS

COLUMNS returns the number of columns in a given range or array. It is the horizontal counterpart to ROWS and is useful when building dynamic formulas that must account for the width of a dataset, such as in combination with INDEX, OFFSET, or array operations.

Excel
=COLUMNS(A1:D1)
Google Sheets
=COLUMNS(A1:D1)

Verified example

Computed by a real spreadsheet engine on the sample data below.

NameAgeCityScore
Alice30NY88
Bob25LA92

=COLUMNS(A1:D1)4

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How it works

  1. 1A1:D1 is the range whose column count you want.
  2. 2COLUMNS spans from column A (1) to column D (4), so the result is 4.
  3. 3Works on multi-row ranges too — it always returns the width, not the total cell count.

Need a version for your data?

Try: “Count how many columns are in my table header row

Related

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: