This function returns the number of columns in an array.
COLUMNS(array)
The argument is an array, an array formula, or a range of cells.
Accepts cell references or array. Returns numeric data.
COLUMNS(B6:D12) gives the result 3
COLUMNS(R6C2:R12C4) gives the result 3
COLUMNS($B$8:$H$8) gives the result 7
COLUMNS(R[2]C[1]:R[3]C[8]) gives the result 8