Google Sheets function · Lookup
ROWS in Google Sheets: syntax and examples
ROWS counts the rows of a range or array and ignores what is inside. It is the usual way to size a table, to count what FILTER or UNIQUE returned, or to know how many records a table holds.
Syntax
ROWS(range)
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
range | range | yes | The range or array whose rows are counted. |
Examples
The examples use this table, starting in A1:
| Item | Team | Qty |
| Lamp | A | 5 |
| Chair | B | 0 |
| Stand | A | 7 |
| Tray | B | 40 |
=ROWS(A1:C5)Result: 5
The table has five rows, header included.
Run in a Google Sheet (English US locale) on .
=ROWS(A2:C5)Result: 4
Data rows only, without the header.
Run in a Google Sheet (English US locale) on .
=ROWS({1; 2; 3})Result: 3
A typed array: semicolons separate rows.
Run in a Google Sheet (English US locale) on .
=ROWS(FILTER(A2:C5, B2:B5="A"))Result: 2
How many rows a FILTER returns: items from team A.
Run in a Google Sheet (English US locale) on .
=ROWS(UNIQUE(B2:B5))Result: 2
The number of distinct teams.
Run in a Google Sheet (English US locale) on .
=ROWS(A2:C5) * COLUMNS(A2:C5)Result: 12
Rows times columns: the number of cells in the block.
Run in a Google Sheet (English US locale) on .
Common errors
- ROWS counts every row of the range, blank ones and the header included. ROWS(A1:C10) is 10 even if only five rows have data. Start the range under the header, as in A2:C5, to count records.
- On a FILTER with no matches, ROWS returns #N/A and not 0. Wrap it in IFERROR to get 0.
- It takes one argument. ROWS(A1:C5, A1:C5) and ROWS() both return #N/A.
- For the number of filled cells use COUNTA instead. ROWS only measures the shape of the range.
Compared with Excel
Same syntax in Excel.