Get number of columns in excel

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 More…Less

If you need a quick way to count rows that contain data, select all the cells in the first column of that data (it may not be column A). Just click the column header. The status bar, in the lower-right corner of your Excel window, will tell you the row count.

Do the same thing to count columns, but this time click the row selector at the left end of the row.

The status bar then displays a count, something like this:

A row count in the Excel status bar

If you select an entire row or column, Excel counts just the cells that contain data. If you select a block of cells, it counts the number of cells you selected. If the row or column you select contains only one cell with data, the status bar stays blank.

Notes: 

  • If you need to count the characters in cells, see Count characters in cells.

  • If you want to know how many cells have data, see Use COUNTA to count cells that aren’t blank.

  • You can control the messages that appear in the status bar by right-clicking the status bar and clicking the item you want to see or remove. For more information, see Excel status bar options.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Need more help?

In this article, we will learn about how to Count table rows & columns in Excel.

In simple words, while working with large data in Excel we need to find the number of rows or columns in excel table.

The ROWS function in excel returns the number of rows in an array.
Syntax:

The COLUMNS function in excel returns the number of columns in an array.
Syntax:

Let’s understand this function using it in an example.

Here we have large data A2:H245 named Sales_Data

0033
Here we need to find out the number of rows & columns of Sales_Data table in Excel.

Use the formula to get the number of rows

A2:H245 : Sales_Data table as an array.
0045
We got the number of rows of the Sales_Data.
Use the formula to get the number of rows

A2:H245 : Sales_Data table as an array.
0046
As you can see the ROWS & COLUMNS functions returns the number of rows & columns of table.

Hope you understood how to use ROWS function and COLUMNS function in Excel. Explore more articles on Excel cell info function functions here. Please feel free to state your query or feedback for the above article.

Related Articles :

How to use the CELL function in Excel

How to use the ROW function in Excel

How to use the COLUMN Function in Excel

Popular Articles :

50 Excel Shortcut to Increase Your Productivity : Get faster at your task. These 50 shortcuts will make you work even faster on Excel.

How to use the VLOOKUP Function in Excel : This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.

How to use the COUNTIF function in Excel : Count values with conditions using this amazing function. You don’t need to filter your data to count specific values. Countif function is essential to prepare your dashboard.

How to use the SUMIF Function in Excel : This is another dashboard essential function. This helps you sum up values on specific conditions.

Summary

The Excel COLUMNS function returns the count of columns in a given reference. For example, COLUMNS(A1:C3) returns 3, since the range A1:C3 contains 3 columns.

Purpose 

Get the number of columns in an array or reference.

Return value 

Arguments 

  • array — A reference to a range of cells.

Syntax 

Usage notes 

The COLUMNS function returns the count of columns in a given reference as a number. For example, COLUMNS(A1:C3) returns 3, since the range A1:C3 contains 3 columns. COLUMNS takes just one argument, called array, which should be a range or array.

Examples

Use the COLUMNS function to get the column count for a given reference or range. For example, there are 6 columns in the range A1:F1 so the formula below returns 6:

=COLUMNS(A1:F1) // returns 6

The range A1:Z100 contains 26 columns, so the formula below returns 100: 

=COLUMNS(A1:Z100) // returns 26

You can also use the COLUMNS function to get a column count for an array constant:

=COLUMNS({1,2,3,4,5}) // returns 5

Although there is no built-in function to count the number of cells in a range, you can use the COLUMNS function together with the ROWS function like this:

=COLUMNS(range)*ROWS(range) // total cells
=COLUMNS(A1:Z100)*ROWS(A1:Z100) // returns 2600

More details here.

Notes

  • Array can be a range or a reference to a single contiguous group of cells.
  • Array can be an array constant or an array created by another formula.
  • To count rows, see the ROW function.
  • To get column numbers, see the COLUMN function.
  • To lookup a column number, see the MATCH function.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi — I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.

Excel COLUMNS Function (Example + Video)

Excel COLUMNS Function

When to use Excel COLUMNS Function

Excel COLUMNS function can be used when you want to get the number of columns in a specified range or array.

What it Returns

It returns a number that represents the total number of columns in the specified range or array.

Syntax

=COLUMNS(array)

Input Arguments

  • array – it could be an array, an array formula or a reference to a contiguous range of cells.

Additional Notes

  • Even if the array contains multiple rows and columns, only the columns are counted. For example:
    • COLUMNS(A1:B1) returns 2.

    • COLUMNS(A1:B100) also returns 2.

  • This formula can be useful when you want to get a sequence of numbers as you go to the right in your worksheet.
    • For example, if you want 1 in A1, 2 in B1, 3 in C1 and so on, use the following formula =COLUMNS($A$1:A1). As you would drag this to the right, the reference inside it would change and the number of columns in the reference would get incremented by one. For example, when you drag it to column B1, the formula becomes COLUMNS($A$1:B1) which then returns 2.

Excel COLUMNS Function – Examples

Here are two examples of using the Excel COLUMNS function.

Example 1: Finding the number of Columns in an Array

Excel COLUMNS Function - Example 1

In the example above, =COLUMNS(A1:A1) returns 1 as it covers one row (which is A1). Similarly, =COLUMNS(A1:C1) returns 3 as the array A1:C1 covers four columns in it.

Also, note that it only counts the number of columns. Hence, whether the array is A1:C1, or A1:C5, it would return 3 in both the cases.

Example 2: Getting a Sequence of Numbers in a Column

Excel COLUMNS Function - Example 2

Excel COLUMNS function can be used to get a sequence of numbers. Since the first reference is fixed, as you copy the formula down, the second reference changes and so does the row numbers in the array.

Excel COLUMNS Function – Video Tutorial

Related Excel Functions:

  • Excel COLUMN Function.
  • Excel ROW Function.
  • Excel ROWS Function

Other articles you may also like:

  • Row vs Column in Excel – What’s the Difference?
Date yes Add (Subtract) Days to a Date Concatenate Dates Convert Date to Number Convert Date to Text Month Name to Number Create Date Range from Dates Day Number of Year Month Name from Date First Day of Month Add (Subtract) Weeks to a Date If Functions with Dates Max Date Number of Days Between Dates Number of Days in a Month Number of Weeks Between Dates Number of Years Between Dates Split Date & Time into Separate Cells Countdown Remaining Days Insert Dates Random Date Generator Using Dynamic Ranges — Year to Date Values Add (Subtract) Years to a Date Date Formula Examples Extract Day from Date Get Day Name from Date Count Days Left in Month / Year Count Workdays Left in Month / Year Get Last Day of Month Last Business Day of Month / Year Number of Work / Business Days in Month Weekday Abbreviations Auto Populate Dates Number of Months Between Dates Quarter from a Date Years of Service Change Date Format Compare Dates Time yes Add (Subtract) Hours to Time Add (Subtract) Minutes to Time Add (Subtract) Seconds to Time Add Up time (Total Time) Time Differences Change Time Format Convert Minutes to Hours Convert Time to Decimal Convert Time to Hours Convert Time to Minutes Convert Time to Seconds Military Time Round Time to Nearest 15 Minutes Overtime Calculator Number of Hours Between Times Convert Seconds to Minutes, Hours, or Time Count Hours Worked Time Differences Time Format — Show Minutes Seconds Text yes Add Commas to Cells Get First Word from Text Capitalize First Letter Clean & Format Phone #s Remove Extra Trailing / Leading Spaces Add Spaces to Cell Assign Number Value to Text Combine Cells with Comma Combine First and Last Names Convert Text String to Date Convert Text to Number Extract Text From Cell Get Last Word Remove Unwated Characters Extract Text Before or After Character How to Split Text String by Space, Comma, & More Remove Special Characters Remove First Characters from Left Substitute Multiple Values Switch First & Last Names w/ Commas Remove Specific Text from a Cell Extract Text Between Characters (Ex. Parenthesis) Add Leading Zeros to a Number Remove Line Breaks from Text Remove all Numbers from Text Reverse Text Remove Non-Numeric Characters Remove Last Character(s) From Right Separate First and Last Names Separate Text & Numbers Round yes Round Formulas Round Price to Nearest Dollar or Cent Round to Nearest 10, 100, or 1000 Round to Nearest 5 or .5 Round Percentages Round to Significant Figures Count yes Count Blank and Non-blank Cells Count Cells Between Two Numbers Count Cells not Equal to Count if Cells are in Range Count Times Word Appears in Cell Count Words in Cell Count Specific Characters in Column Count Total Number of Characters in Column Count Cells that Equal one of two Results Count Cells that do not Contain Count Cells that Contain Specific Text Count Unique Values in Range Countif — Multiple Criteria Count Total Number of Cells in Range Count Cells with Any Text Count Total Cells in a Table Lookup yes Two Dimensional VLOOKUP VLOOKUP Simple Example Vlookup — Multiple Matches Case Sensitive Lookup Case Sensitive VLOOKUP Sum if — VLOOKUP Case Sensitive Lookup Case Sensitive VLOOKUP Find Duplicates w/ VLOOKUP or MATCH INDEX MATCH MATCH Lookup — Return Cell Address (Not Value) Lookup Last Value in Column or Row Reverse VLOOKUP (Right to Left) Risk Score Bucket with VLOOKUP Sum with a VLOOKUP Function VLOOKUP & INDIRECT VLOOKUP Concatenate VLOOKUP Contains (Partial Match) 17 Reasons Why Your XLOOKUP is Not Working Double (Nested) XLOOKUP — Dynamic Columns IFERROR (& IFNA) XLOOKUP Lookup Min / Max Value Nested VLOOKUP Top 11 Alternatives to VLOOKUP (Updated 2022!) VLOOKUP – Dynamic Column Reference VLOOKUP – Fix #N/A Error VLOOKUP – Multiple Sheets at Once VLOOKUP & HLOOKUP Combined VLOOKUP & MATCH Combined VLOOKUP Between Worksheets or Spreadsheets VLOOKUP Duplicate Values VLOOKUP Letter Grades VLOOKUP Return Multiple Columns VLOOKUP Returns 0? Return Blank Instead VLOOKUP w/o #N/A Error XLOOKUP Multiple Sheets at Once XLOOKUP Between Worksheets or Spreadsheets XLOOKUP by Date XLOOKUP Duplicate Values XLOOKUP Multiple Criteria XLOOKUP Return Multiple Columns XLOOKUP Returns 0? Return Blank Instead XLOOKUP Text XLOOKUP with IF XLOOKUP With If Statement Misc. yes Sort Multiple Columns Use Cell Value in Formula Percentage Change Between Numbers Percentage Breakdown Rank Values Add Spaces to Cell CAGR Formula Average Time Decimal Part of Number Integer Part of a Number Compare Items in a List Dealing with NA() Errors Get Worksheet Name Wildcard Characters Hyperlink to Current Folder Compound Interest Formula Percentage Increase Create Random Groups Sort with the Small and Large Functions Non-volatile Function Alternatives Decrease a Number by a Percentage Calculate Percent Variance Profit Margin Calculator Convert Column Number to Letter Get Full Address of Named Range Insert File Name Insert Path Latitute / Longitude Functions Replace Negative Values Reverse List Range Convert State Name to Abbreviation Create Dynamic Hyperlinks Custom Sort List with Formula Data Validation — Custom Formulas Dynamic Sheet Reference (INDIRECT) Reference Cell in Another Sheet or Workbook Get Cell Value by Address Get Worksheet Name Increment Cell Reference List Sheet Names List Skipped Numbers in Sequence Return Address of Max Value in Range Search by Keywords Select Every Other (or Every nth) Row Basics yes Cell Reference Basics — A1, R1C1, 3d, etc. Add Up (Sum) Entire Column or Row Into to Dynamic Array Formulas Conversions yes Convert Time Zones Convert Celsius to Fahrenheit Convert Pounds to Kilograms Convert Time to Unix Time Convert Feet to Meters Convert Centimeters to Inches Convert Kilometers to Miles Convert Inches to Feet Convert Date to Julian Format Convert Column Letter to Number Tests yes Test if a Range Contains any Text Test if any Cell in Range is Number Test if a Cell Contains a Specific Value Test if Cell Contains Any Number Test if Cell Contains Specific Number Test if Cell is Number or Text If yes Percentile If Subtotal If Sumproduct If Large If and Small If Median If Concatentate If Max If Rank If TEXTJOIN If Sum yes Sum if — Begins With / Ends With Sum if — Month or Year to Date Sum if — By Year Sum if — Blank / Non-Blank Sum if — Horizontal Sum Count / Sum If — Cell Color INDIRECT Sum Sum If — Across Multiple Sheets Sum If — By Month Sum If — Cells Not Equal To Sum If — Not Blank Sum if — Between Values Sum If — Week Number Sum Text Sum if — By Category or Group Sum if — Cell Contains Specific Text (Wildcards) Sum if — Date Rnage Sum if — Dates Equal Sum if — Day of Week Sum if — Greater Than Sum if — Less Than Average yes Average Non-Zero Values Average If — Not Blank Average — Ignore 0 Average — Ignore Errors Math yes Multiplication Table Cube Roots nth Roots Square Numbers Square Roots Calculations yes Calculate a Ratio Calculate Age KILLLLLLL Calculate Loan Payments GPA Formula Calculate VAT Tax How to Grade Formulas Find yes Find a Number in a Column / Workbook Find Most Frequent Numbers Find Smallest n Values Find nth Occurance of Character in Text Find and Extract Number from String Find Earliest or Latest Date Based on Criteria Find First Cell with Any Value Find Last Row Find Last Row with Data Find Missing Values Find Largest n Values Most Frequent Number Conditional Formatting yes Conditional Format — Dates & Times Conditional Format — Highlight Blank Cells New Functions XLOOKUP Replaces VLOOKUP, HLOOKUP, and INDEX / MATCH Logical yes AND Checks whether all conditions are met. TRUE/FALSE IF If condition is met, do something, if not, do something else. IFERROR If result is an error then do something else. NOT Changes TRUE to FALSE and FALSE to TRUE. OR Checks whether any conditions are met. TRUE/FALSE XOR Checks whether one and only one condition is met. TRUE/FALSE Lookup & Reference yes FALSE The logical value: FALSE. TRUE The logical value: TRUE. ADDRESS Returns a cell address as text. AREAS Returns the number of areas in a reference. CHOOSE Chooses a value from a list based on it’s position number. COLUMN Returns the column number of a cell reference. COLUMNS Returns the number of columns in an array. HLOOKUP Lookup a value in the first row and return a value. HYPERLINK Creates a clickable link. INDEX Returns a value based on it’s column and row numbers. INDIRECT Creates a cell reference from text. LOOKUP Looks up values either horizontally or vertically. MATCH Searches for a value in a list and returns its position. OFFSET Creates a reference offset from a starting point. ROW Returns the row number of a cell reference. ROWS Returns the number of rows in an array. TRANSPOSE Flips the oriention of a range of cells. VLOOKUP Lookup a value in the first column and return a value. Date & Time yes DATE Returns a date from year, month, and day. DATEDIF Number of days, months or years between two dates. DATEVALUE Converts a date stored as text into a valid date DAY Returns the day as a number (1-31). DAYS Returns the number of days between two dates. DAYS360 Returns days between 2 dates in a 360 day year. EDATE Returns a date, n months away from a start date. EOMONTH Returns the last day of the month, n months away date. HOUR Returns the hour as a number (0-23). MINUTE Returns the minute as a number (0-59). MONTH Returns the month as a number (1-12). NETWORKDAYS Number of working days between 2 dates. NETWORKDAYS.INTL Working days between 2 dates, custom weekends. NOW Returns the current date and time. SECOND Returns the second as a number (0-59) TIME Returns the time from a hour, minute, and second. TIMEVALUE Converts a time stored as text into a valid time. TODAY Returns the current date. WEEKDAY Returns the day of the week as a number (1-7). WEEKNUM Returns the week number in a year (1-52). WORKDAY The date n working days from a date. WORKDAY.INTL The date n working days from a date, custom weekends. YEAR Returns the year. YEARFRAC Returns the fraction of a year between 2 dates. Engineering yes CONVERT Convert number from one unit to another. Financial yes FV Calculates the future value. PV Calculates the present value. NPER Calculates the total number of payment periods. PMT Calculates the payment amount. RATE Calculates the interest Rate. NPV Calculates the net present value. IRR The internal rate of return for a set of periodic CFs. XIRR The internal rate of return for a set of non-periodic CFs. PRICE Calculates the price of a bond. YIELD Calculates the bond yield. INTRATE The interest rate of a fully invested security. Information yes CELL Returns information about a cell. ERROR.TYPE Returns a value representing the cell error. ISBLANK Test if cell is blank. TRUE/FALSE ISERR Test if cell value is an error, ignores #N/A. TRUE/FALSE ISERROR Test if cell value is an error. TRUE/FALSE ISEVEN Test if cell value is even. TRUE/FALSE ISFORMULA Test if cell is a formula. TRUE/FALSE ISLOGICAL Test if cell is logical (TRUE or FALSE). TRUE/FALSE ISNA Test if cell value is #N/A. TRUE/FALSE ISNONTEXT Test if cell is not text (blank cells are not text). TRUE/FALSE ISNUMBER Test if cell is a number. TRUE/FALSE ISODD Test if cell value is odd. TRUE/FALSE ISREF Test if cell value is a reference. TRUE/FALSE ISTEXT Test if cell is text. TRUE/FALSE N Converts a value to a number. NA Returns the error: #N/A. TYPE Returns the type of value in a cell. Math yes ABS Calculates the absolute value of a number. AGGREGATE Define and perform calculations for a database or a list. CEILING Rounds a number up, to the nearest specified multiple. COS Returns the cosine of an angle. DEGREES Converts radians to degrees. DSUM Sums database records that meet certain criteria. EVEN Rounds to the nearest even integer. EXP Calculates the exponential value for a given number. FACT Returns the factorial. FLOOR Rounds a number down, to the nearest specified multiple. GCD Returns the greatest common divisor. INT Rounds a number down to the nearest integer. LCM Returns the least common multiple. LN Returns the natural logarithm of a number. LOG Returns the logarithm of a number to a specified base. LOG10 Returns the base-10 logarithm of a number. MOD Returns the remainder after dividing. MROUND Rounds a number to a specified multiple. ODD Rounds to the nearest odd integer. PI The value of PI. POWER Calculates a number raised to a power. PRODUCT Multiplies an array of numbers. QUOTIENT Returns the integer result of division. RADIANS Converts an angle into radians. RAND Calculates a random number between 0 and 1. RANDBETWEEN Calculates a random number between two numbers. ROUND Rounds a number to a specified number of digits. ROUNDDOWN Rounds a number down (towards zero). ROUNDUP Rounds a number up (away from zero). SIGN Returns the sign of a number. SIN Returns the sine of an angle. SQRT Calculates the square root of a number. SUBTOTAL Returns a summary statistic for a series of data. SUM Adds numbers together. SUMIF Sums numbers that meet a criteria. SUMIFS Sums numbers that meet multiple criteria. SUMPRODUCT Multiplies arrays of numbers and sums the resultant array. TAN Returns the tangent of an angle. TRUNC Truncates a number to a specific number of digits. Stats yes AVERAGE Averages numbers. AVERAGEA Averages numbers. Includes text & FALSE =0, TRUE =1. AVERAGEIF Averages numbers that meet a criteria. AVERAGEIFS Averages numbers that meet multiple criteria. CORREL Calculates the correlation of two series. COUNT Counts cells that contain a number. COUNTA Count cells that are non-blank. COUNTBLANK Counts cells that are blank. COUNTIF Counts cells that meet a criteria. COUNTIFS Counts cells that meet multiple criteria. FORECAST Predict future y-values from linear trend line. FREQUENCY Counts values that fall within specified ranges. GROWTH Calculates Y values based on exponential growth. INTERCEPT Calculates the Y intercept for a best-fit line. LARGE Returns the kth largest value. LINEST Returns statistics about a trendline. MAX Returns the largest number. MEDIAN Returns the median number. MIN Returns the smallest number. MODE Returns the most common number. PERCENTILE Returns the kth percentile. PERCENTILE.INC Returns the kth percentile. Where k is inclusive. PERCENTILE.EXC Returns the kth percentile. Where k is exclusive. QUARTILE Returns the specified quartile value. QUARTILE.INC Returns the specified quartile value. Inclusive. QUARTILE.EXC Returns the specified quartile value. Exclusive. RANK Rank of a number within a series. RANK.AVG Rank of a number within a series. Averages. RANK.EQ Rank of a number within a series. Top Rank. SLOPE Calculates the slope from linear regression. SMALL Returns the kth smallest value. STDEV Calculates the standard deviation. STDEV.P Calculates the SD of an entire population. STDEV.S Calculates the SD of a sample. STDEVP Calculates the SD of an entire population TREND Calculates Y values based on a trendline. Text yes CHAR Returns a character specified by a code. CLEAN Removes all non-printable characters. CODE Returns the numeric code for a character. CONCATENATE Combines text together. DOLLAR Converts a number to text in currency format. EXACT Test if cells are exactly equal. Case-sensitive. TRUE/FALSE FIND Locates position of text within a cell.Case-sensitive. LEFT Truncates text a number of characters from the left. LEN Counts number of characters in text. LOWER Converts text to lower case. MID Extracts text from the middle of a cell. PROPER Converts text to proper case. REPLACE Replaces text based on it’s location. REPT Repeats text a number of times. RIGHT Truncates text a number of characters from the right. SEARCH Locates position of text within a cell.Not Case-sensitive. SUBSTITUTE Finds and replaces text. Case-sensitive. TEXT Converts a value into text with a specific number format. TRIM Removes all extra spaces from text. UPPER Converts text to upper case. VALUE Converts a number stored as text into a number.

In this tutorial, we would unlock one of the reference functions called the COLUMNS function in Excel. The excel reference functions are nothing but those excel formulas which return a reference of the cell.

This blog covers the use of COLUMNS excel formula, function syntax and arguments, and its examples.

When to Use Excel COLUMNS Formula

The COLUMNS formula in excel is used to find the number of columns within an array or range of cells. It means it helps to return or get the count of columns in a range of cells or array.

The result of this formula is a whole number (1, 2, 3, 4, … and so on).

Syntax and Argument

=COLUMNS(array)

As seen above, the COLUMNS excel formula in contains one argument which is ‘array’.

  • array – In this argument, specify the array or a reference to a range of cells.

Let us consider one very basic example of the COLUMNS formula. Finding number of columns between two cells becomes very easy with this formula.

Suppose you want to count how many columns exist between two cells (A15 and AZ15). In that case, use the below formula:

=COLUMNS(A15:AZ15)

As a result, you would notice that excel returns the count of columns between these excel cell references. The result comes to 52, meaning there are in total 52 columns in between these two cell references.

Finding Number of Columns in Excel

Do Not Miss These Points

Below are some important points that you need to consider while using the COLUMNS function in Excel-

Infographic - COLUMNS Formula Function in Excel
  • This formula only counts the columns and ignores the count of rows in the array or cell reference. For example, =COLUMNS(A15:AZ15) and =COLUMNS(A15:AZ25) both the formulas would return 52 as output.
Ignore Row Reference in Counting
  • This formula is very useful when you want to get the sequence of numbers from 1 to n in columns something like this:
Practical Use of COLUMNS Excel Function
  • In the above image, we have used the formula =COLUMNS($A$1:A$1) to return the number of columns between $A$1 and A$1 in cell A1. We have then copied this formula to other columns (B, C, D … and so on). By keeping A as a non-absolute reference in A$1, excel increments to B, C, D, and so on as you copy it to other columns B1, C1, etc.

RELATED POSTS

  • CELL Function in Excel – Get Information About Cell

  • Excel COUNT Function – Count Cell Containing Numbers

  • ADDRESS Function in Excel – Get Excel Cell Address

  • ROW Function in Excel – Get Cell Row Number

  • SEQUENCE Function in Excel – Generate Number Series

  • AREAS Function in Excel – Areas of Reference

Excel allows a user to count table columns, using the COLUMNS function. This step by step tutorial will assist all levels of Excel users in counting table columns.

Figure 1. The result of the formula

Syntax of the Formula

The generic formula is:

=COLUMNS(array)

The parameter of the COLUMNS function is:

  • array – an array of cells in a table for which we want to count columns or a table name.

Setting up Our Data for the Example

Let’s look at the structure of the data we will use. In column B, we have the price and in column C, we have the cost. In column D, we want to calculate a profit margin percentage.

Figure 2. Data that we will use in the example

Counting a Table Columns with a Range

In the first example, we want to count columns in the Excel table, using the table range.

The formula looks like:

=COLUMNS(B2:D7)

The parameter array is the range B2:D7.

To apply the formula, we need to follow these steps:

  • Select cell F3 and click on it
  • Insert the formula: =COLUMNS(B2:D7)
  • Press enter

Figure 3. Counting the table columns with the range

The result in the cell D3 is 3, as there are 3 columns in the table.

Counting a Table Columns with a Table Name

In this example, we want to count the number of columns in the table, using the table name. The table in the range B2:D7 has name “Table1”.

The formula looks like:

=COLUMNS(Table1)

The parameter array is the range Table1.

To apply the formula, we need to follow these steps:

  • Select cell F3 and click on it
  • Insert the formula: =COLUMNS(Table1)
  • Press enter

Figure 4. Counting the table columns with the table name

As we can see in Figure 4, the result in the cell D3 is 3, the same as in the previous example.

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

The COLUMNS function is a built-in function in Microsoft Excel. It falls under the category of LOOKUP functions in Excel. The COLUMNS function returns the total number of columns in the given array or collection of references. The purpose of the COLUMNS formula in Excel is to know the number of columns in an array of references.

For example, the formula =COLUMNS(A1:E3) will return as 5 since the range A1:E3 has 5 columns, A, B, C, D, and E, respectively.

Table of Contents
  • What Is COLUMNS Function In Excel?
    • Syntax
    • How To Use COLUMNS Formula In Excel?
    • Examples
    • Important Things To Note
    • Frequently Asked Questions
    • Columns Function in Excel Video
    • Recommended Articles
  • The COLUMNS function in excel is used to find the number of columns used in the worksheet.
  • The formula of the columns function in excel is =COLUMN(array), where the array is the only mandatory argument.
  • The array shows the range of cells for which the number of columns is derived.
  • We can choose either a single cell or a range as the value in the array argument.
  • It is important to know that the function will return only the number of columns even if the chosen array has multiple rows and columns.

Syntax

Columns formula in excel

  • array = This is a required parameter. An array / a formula resulting in an array / a reference to a range of Excel cells for which the number of columns is to be calculated.

The COLUMNS function has only one argument, and it is mandatory.

How To Use COLUMNS Formula In Excel?

You can download this COLUMNS Function Excel Template here – COLUMNS Function Excel Template

The said function is a worksheet (WS) function. As a WS function, columns can be inserted as a part of the formula in a worksheet cell.

Let us look at the examples given below to understand the use of the COLUMNS function in excel.

Examples

Example #1 – Total Columns In A Range

Columns Function Example 1

In the example of this column, cell G3 has a formula associated with it. So, G3 is a result cell.

The argument for the COLUMNS function in excel is a cell range, which is B4:D4. Here, B4 is a starting cell, and D4 is the ending cell.

The number of columns between these two cells is 3. So, the result is 3.

Example #2 – Total Cells In A Range

Example 2

In this example, cell G4 has a formula associated with it. So, G4 is a result cell.

The formula is COLUMNS (B4: E8) * ROWS*B4: E8). Then, multiplication is performed between the total number of columns and a total number of rows for the given range of cells in the sheet.

Here, the total number of columns is four, and the total number of rows is 5. So, the total number of cells is 4*5 = 20.

Example #3 – Get The Address Of The First Cell In A Range

Example 3

Here, the dataset is named data. Further, this data is used in the formula.

You may refer to the steps given below to name the dataset.

  • Step 1: Select the cells.
  • Step 2: Right-click and choose Define Name.
  • Step 3: Name the dataset as data.

Example 3-1

In the example of these columns, cell G6 has a formula associated with it. So, G6 is a result cell. The formula is to calculate the first cell in the dataset represented by the name data. The result is $B$4, i.e., B4, the last cell in the selected dataset.

The formula uses the ADDRESSES function, which has two parameters: row number and column number.

E.g., ADDRESS (8,5) returns $B$4. Here, 4 is the row number, and 2 is the column number. So, the function returns a cell denoted by these row and column numbers.

Here, a row number is calculated by

ROW(data)

And the column number is calculated by

COLUMN(data)

Example 4 – Get The Address Of The Last Cell In A Range

Example 4

Here, the dataset is named data. Further, this data is used in the column’s formula in Excel. We can refer to the steps given below to name the dataset.

  • Step 1: Select the cells.
  • Step 2: Right-click and choose Define Name.
  • Step 3: Name the dataset as data.

Example 4-1

In this COLUMNS example, cell G5 has a formula associated with it. So, G5 is a result cell. The formula is to calculate the last cell in the dataset represented by the name data. The result is $E$8, i.e., E8, the last cell in the selected dataset.

The formula uses the ADDRESSES function, which has two parameters: row number and column number.

E.g., ADDRESS (8,5) returns $E$8. Here, 8 is the row number, and 5 is the column number. So, the function returns a cell denoted by these row and column numbers.

Here, the row number is calculated by

ROW(data)+ROWS(data-1)

And the column number is calculated by

COLUMN(data)+COLUMNS(data-1)

Important Things To Note

  • The argument of the COLUMNS function in Excel can be a single cell address or a range of cells.
  • The argument of the COLUMNS function cannot point to multiple references or cell addresses.

Frequently Asked Questions

1) What is the columns function in excel?

Columns Function in excel is a built-in excel function used to derive the number of columns used in the worksheet. The syntax of the COLUMNS function in excel is =COLUMNS(array). For example, consider the table with details of 3 employees.
columns function in excel 1
We can calculate the number of columns used in the data using the columns function in excel.
columns function in excel 1-1
Step 2: Select the range A1:C4 as shown in the below image.
columns function in excel 1-2
Step 3: Press Enter key
We will get the result as shown in the below image.
columns function in excel 1-3

2) When can we use the columns function in excel?

Columns Function in excel is used when we have to find the number of columns used in the data. Especially while working with large datasets, this function will be useful.

3) How to insert columns function in excel?

We can insert columns function in excel by selecting Formulas > Lookup & Reference in the Function Library group > COLUMNS function.
insert columns function in excel
Alternatively, we can also type =COLUMNS and choose the cell array.

Columns Function in Excel Video

Recommended Articles

This article is a guide to Columns Function in Excel. We discuss the columns formula in Excel and how to use it, along with examples and downloadable templates. You can also go through our other suggested articles: –

  • Excel Column Lock
  • Excel Freeze Columns
  • Group Column in Excel
  • Column in Excel
  • Break Links in Excel

Понравилась статья? Поделить с друзьями:
  • Get number of column excel
  • Get number of cells excel
  • Get number from excel cell
  • Get my tongue round this word
  • Get months in excel