Note: The other languages of the website are Google-translated. Back to English

Excel COLUMNS function

doc columns function 1

Description

Syntax and Arguments

Usage and Examples


Description

The COLUMNS function returns the total number of columns in a given array or reference. For example, COLUMNS(A1:D4) returns 4.

Syntax and arguments

Formula syntax

=COLUMNS(array)

Arguments

  • Array: Required. It’s an array or an array formula or a reference of a range of cells which you want to count the total number of columns.

Return Value

The COLUMNS function returns the number of columns in an array or reference.

Usage and Examples

With the COLUMNS function you not only can count the numbers of a range, but also solve other jobs.

Example1: Count total number of columns in a range

Formula1

=COLUMNS(A1:D1)

Explain: Count the total number of columns in the range of A1:D1

Result:4


Formula2

=COLUMNS(DATA)

Explain: Count the total number of columns in the defined name range of “DATA” (range A1:D10)

Result: 4
doc columns function 2


Example2: Count total number of cells in a range

With combining the ROWS function and the COLUMNS function, you can obtain the total number of cells in a given range.

Formula

=ROWS(DATA)*COLUMNS(DATA)

Explain:

Data: the defined name which you want to count the total number of cells.

ROWS: return the total number of rows from the given reference

Result: 40
doc columns function 3


Example3: Obtain the last cell address of a given range

Formula

=ADDRESS(ROWS(DATA),COLUMNS(DATA))

Explain:

ADDRESS(row_num,column_num): returns the cell address based on the given row number and column number.

ROWS(): returns the total number of rows.

COLUMNS(): returns the total number of columns.

Then the formula shown as this:

=ADDRESS(10,4)

Result: $D$10
doc columns function 4


Sample File
doc sample file


The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Comments (1)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How can I add information from Sheet1 -ColumnD to Sheet3-ColumnB?
Can I have information on Sheet3 automatically updated when the information on Sheet1 is changed?
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations