COLUMNS Function in Excel: How Many Columns in a Range

COLUMNS Function in Excel: How Many Columns in a Range featured illustration

πŸ“Ž This article includes 1 downloadable practice file ↓

⏱ 2 min readUpdated 13 October 2026

LookupLevel: IntermediateAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. COLUMNS in practice
  5. Where you will use it
  6. Worked example
  7. Mistakes people make
  8. Related functions
  9. Continue learning

COLUMNS counts columns in a range β€” useful for dynamic column numbers and checks.

Advertisement

Syntax

=COLUMNS(array)
Argument What it means
array Range or array.

Examples

Example 1

=INDEX($B2:$M2, COLUMNS($B2:B2))

Walk across a row as you fill right.

COLUMNS in practice

Where you will use it

  • Count columns in a range or table
  • Make a running counter as you copy right
  • Check that an import has the expected number of fields

Worked example

RangeFormulaResult
A1:D1=COLUMNS(INDIRECT(A2))4
B2:M2=COLUMNS(INDIRECT(A3))12
A:Z=COLUMNS(INDIRECT(A4))26

Results calculated in Excel.

Mistakes people make

MistakeWhat to do instead
Confusing with COLUMNCOLUMNS counts; COLUMN gives the position
Hard-coding sizesCOLUMNS(Table1) updates when columns are added

COLUMN Β· ROWS

πŸ“š Part of the free Excel course: Beginner β†’ Expert Β· Try it in the Formula Lab or ask the AI Helper.

⚑ Interactive Practice Lab & Formula Tester:

Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.

πŸ“Ž Practice files for this article

  • πŸ“—
    Practice workbook: Lookup & reference17 tasks on realistic sales data β€” type your formula, the Check column turns green when it is right. Answers sheet included.
    ⬇ XLSX Β· 35 KB

Free to use for learning. Files with macros (.bas) are plain text β€” import them with Alt+F11 β†’ File β†’ Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free Β· AI can be wrong

Leave a Reply

Your email address will not be published. Required fields are marked *