The COLUMNS function returns the number of columns in an array or reference.
Formula:
= COLUMNS(array)
Explanation:
Array is required. The number of the columns of the data range you are looking for.
=COLUMNS (A2:B5) returns 2 which is the number of columns of the data range A2:B5, there are 2 columns.
=COLUMNS (A2:A5) returns 1 which is the number of columns of the data range A2:A5, only 1 column.