Function Reference: COLUMNS, ROWS

Syntax
=COLUMNS(array)
=ROWS(array)
=SHEETS([reference])
Purpose / Description
Returns the count of columns (COLUMNS) or rows (ROWS) in an array or referenced range.
The SHEETS function returns the count of sheets in a referenced range or a workbook.
Arguments
NameTypeDescription
arrayreference or array of anyA constant array, reference or a nested expression that returns an array or reference, whose dimension is to be derived.
[reference]referenceAn optional reference or nested expression that returns a reference to a range.  If omitted the result returned will be for the whole workbook.
Return Values
TypeSpecific ValueDescription
number1If a single constant value is passed to the array argument, the result is 1.
number The number of columns (COLUMNS) or rows (ROWS) in an array or referenced range.
The number of sheets in a range (SHEETS).  If the reference argument is omitted, it is the count of sheets in the workbook.
error#REF!If a reference is passed to the array argument has more than one area, or is derived by expression that returns an invalid range reference.
error#N/AIf the value passed to the reference argument is a constant value, not a reference.
error If a single error value is passed to the array argument, the result is the error value.
Notes / Comments / Advice / Warnings
Note:Except when a single error value is passed to the function, error values are not returned, since the result depends upon the dimensions of the range, not its values.
Examples:Open / download sample workbook: AREAS, COLUMN, COLUMNS, ROW, ROWS, SHEET, SHEETS.xlsx