The COLUMNS function in Excel returns the number of columns in a given range.

Here’s the syntax for the COLUMNS function:

=COLUMNS(array)

The “array” argument is the range of cells that you want to count the number of columns in.

For example, to count the number of columns in the range A1:D1, you would use the following formula:

=COLUMNS(A1:D1)

This would return the value 4, since the range A1:D1 contains 4 columns.

You can also use the COLUMNS function with a named range. For example, if you have a named range called “Data”, you could use the following formula to count the number of columns in that range:

=COLUMNS(Data)