Returns the number of columns in a reference or array.
ไวยากรณ์
COLUMNS(array)อาร์กิวเมนต์
arrayจำเป็น
An array, an array formula, or a reference to a range of cells for which you want the number of columns.
The COLUMNS function counts the total number of columns within a specified range or array. It is commonly used to determine the width of a dataset or to create dynamic references in complex formulas.
=COLUMNS(A1:C5)→3Returns 3 because the range A1:C5 spans three columns (A, B, and C).
Select the cell
Click on the cell where you want to display the column count.
Enter the formula
Type =COLUMNS(range) and replace 'range' with your desired cell reference.
No, the COLUMNS function expects a single reference or array and will return an error if multiple non-contiguous ranges are provided.