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 | ||
Name | Type | Description |
array | reference or array of any | A constant array, reference or a nested expression that returns an array or reference, whose dimension is to be derived. |
[reference] | reference | An 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 | ||
Type | Specific Value | Description |
number | 1 | If 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/A | If 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 | |
- Details
- James Clarkson