## COLUMNS Formula in Excel

COLUMNS function is a built-in function in Microsoft Excel. It falls under the category of Lookup Functions in Excel. 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.

### Syntax

The COLUMNS Formula in Excel is as follows:

* *

COLUMNS Function has only one argument. Where,

**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.

### How to use COLUMNS Formula in Excel?

The said function is a Worksheet (WS) function. As a WS function, Columns can be entered as a part of the formula in a cell of a worksheet. Refer to the examples given below to understand better.

Let’s look at the columns examples given below. Each example covers a different use case implemented using the COLUMNS function.

#### Example 1 – Total columns in a range

In the example of this column, cell G3 has a formula associated with it. So, G3 is a result cell. The argument for 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 in between these two cells is 3. So, the result is 3.

#### Example 2 – Total cells in a range

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). 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 4 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

Here, the dataset is named as ‘data’. Further, this ‘data’ is used in the formula. Refer to the steps given below to name the dataset.

- Step#1. Select the cells.
- Step#2. Right and click and choose ‘Define Name’
- Step#3. Name the dataset as ‘data’.

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 name ‘data’. The result is $B$4 i.e. B4 which is the last cell in the selected dataset.

The formula uses ADDRESSES function which has two parameters namely 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 cell denotes 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

Here, the dataset is named as ‘data’. Further, this ‘data’ is used in the column’s formula in excel. Refer to the steps given below to name the dataset.

- Step#1. Select the cells.
- Step#2. Right and click and choose ‘Define Name’
- Step#3. Name the dataset as ‘data’.

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 name ‘data’. The result is $E$8 i.e. E8 which is the last cell in the selected dataset.

The formula uses ADDRESSES function which has two parameters namely 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 cell denotes by these row and column numbers.

Here,

A row number is calculated by

*ROW(data)+ROWS(data-1) *

And the column number is calculated by

*COLUMN(data)+COLUMNS(data-1)*

### Things to Remember

- 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 in excel cannot point to multiple references or cell addresses.

### Columns Function in Excel Video

### Recommended Articles

This has been a guide to Columns Function in Excel. Here we discuss how to use Columns formula in Excel along with practical examples and downloadable excel templates. You can also go through our other suggested articles –

- 35+ Courses
- 120+ Hours
- Full Lifetime Access
- Certificate of Completion