Jump to content

Documentation/Calc Functions/ROWS

From The Document Foundation Wiki


Function name:

ROWS

Category:

Spreadsheet

Summary:

Determines the number of rows in the given reference to a single cell or to a range of cells.

Syntax:

ROWS(Array)

Returns:

Returns an integer in the range 0 to 1,048,576 (inclusive) which is the count of the rows in the cell(s) specified in the argument.

  • If the Array argument is omitted, then ROWS returns 0.
  • If the Array argument refers to a single cell, then ROWS returns 1.
  • If the Array argument refers to a rectangular cell range, then ROWS returns the number of rows in the range.

Arguments:

Array is a specific cell reference (for example, "$Sheet1.A1"), a specific cell range (for example, "$Sheet1.$C$28:$H$29"), the name of a named or database range, or a constant array (for example, "{1, 3, 5, 7}").

  • If Array is omitted, the value 0 is returned.
  • If Array is not a valid reference to a single cell or a single rectangular cell range, then ROWS reports a parameter list error (Err:504). ROWS does not process references that comprise multiple cell ranges.

Additional details:

  • ROWS counts rows that have been hidden.
  • The value returned by ROWS is not dependent on the contents of the cells in a referenced cell area.

Examples:

Formula Description Returns
=ROWS() Here the argument is omitted and so the function returns the value 0. 0
=ROWS(D8) Here the argument comprises a reference to a single cell and so the function returns the value 1. 1
=ROWS(A1:ZZ1) Here the argument comprises a reference to a range of cells within a single row and so the function returns the value 1. 1
=ROWS($Sheet2.B4:G15) Here the argument comprises a reference to a range of cells straddling 12 rows and so the function returns the value 12. 12
=ROWS(myArea) where the named range myArea covers the cell range C1:D4. Here the argument comprises a reference to a range of cells straddling four rows and so the function returns the value 4. 4
=ROWS({10, 20, 30; 40, 50, 60}) Note: In the English(USA) locale, the comma is a column separator and the semicolon is a row separator. Here the argument comprises a constant array with two rows and three columns, and so the value 2 is returned. 2

Related LibreOffice functions:

COLUMNS

ROW

ODF standard:

Section 6.13.30, part 2

Related (or similar) Excel functions:

ROWS