Excel’s COLUMNS function is a simple yet useful function that returns the number of columns in a range of cells. You can use it to quickly count the number of columns in a table, or to check if a range is empty.
Here’s how to use the COLUMNS function:
- In a cell, type the following formula:
=COLUMNS(range)
- Replace
range
with the cell range that you want to count the columns of. For example, if you want to count the columns in a table that starts in cell A1 and goes to cell C10, you would typeA1:C10
. - Press Enter to see the result. The cell will display the number of columns in the specified range.
Here’s an example of the complete formula: =COLUMNS(A1:C10)
This formula would return the value 3
, because the range A1:C10 has 3 columns.
You can also use the COLUMNS function with an array constant, which is a set of values enclosed in curly braces {}. For example:
=COLUMNS({1,2,3;4,5,6;7,8,9})
This formula would return the value 3
, because the array constant has 3 columns.
Leave a Reply
You must be logged in to post a comment.