Use Excel COLUMNS Function to get the number of columns include in a reference or array. In simple words, you can get the number of columns which are included in the reference.

For example for reference A1:D1 if will return 4, as a result, because you have 4 columns in that reference A, B, C and D.

Syntax

COLUMNS(array)

array An array or range get from which you want to get the number of columns.

More Information on Excel COLUMNS Function

You can also use named range in columns function.

Columns function is not concerned with the values in the cells, it will simply return the number of columns in a reference.

Examples

In the below example, I have used columns function to get the number of columns from range A1:F1.

In the below example, I have used columns function to create serial numbers in headers. I have used fixed cell reference for the first cell in the range and drag it to the left.

Sample File

What’s Next?

To learn more about Excel AVERAGE Function you can check Microsoft’s Help Section. And, if you have a unique idea to use it, I would love to hear from you.