# ROWS function in Excel

> ROWS counts how many rows a range or array has, whether or not the cells contain anything.

Source: https://spreadsheetpractice.com/functions/rows · Updated October 28, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

## Quick answer

- **What it does:** ROWS counts how many rows a range or array has, whether or not the cells contain anything.
- **Syntax:** `=ROWS(array)`
- **Most common use:** `=ROWS(A2:B5)` returns 4 (A two-column, four-row range has 4 rows)
- **Available in:** Every current version
- **Category:** [Lookup functions](https://spreadsheetpractice.com/functions/category/lookup)
- **Returns:** The number of rows.
- **Google Sheets:** Works the same way in Google Sheets.

## What it does

ROWS counts how many rows a range or array has, whether or not the cells contain anything. Use it to size a calculation to a range: a share of rows that meet a target, the number of records a FILTER returned, or a running count that grows as a formula is filled down.

## Syntax

`=ROWS(array)`

| Argument | Required? | What it is |
|---|---|---|
| `array` | Required | A range, an array, or a formula that returns an array. |

## Examples

Each result was calculated by running the formula on the sample sheet.

| Cell | Formula | Result | What it shows |
|---|---|---|---|
| D2 | `=ROWS(A2:B5)` | 4 | A two-column, four-row range has 4 rows |
| D3 | `=SUM(B2:B5)/ROWS(B2:B5)` | 39 | Average hours per week: the total divided by the number of weeks |
| D4 | `=ROWS($B$2:B4)` | 3 | A range that grows as you fill down counts how far down the list you are |

### The sample sheet

Every formula above runs on this data:

|  | A | B | C | D |
|---|---|---|---|---|
| 1 | Week | Hours |  | Result |
| 2 | W1 | 38 |  | 4 |
| 3 | W2 | 42 |  | 39 |
| 4 | W3 | 36 |  | 3 |
| 5 | W4 | 40 |  |  |

## Common mistakes

| What you see | Why, and how to fix it |
|---|---|
| Expecting a count of filled cells | ROWS counts rows whether or not they hold data. Use COUNTA to count cells that aren't empty. |
| Mixing up ROWS and ROW | ROW returns a row number, such as 5 for row 5. ROWS returns how many rows a range spans. |

## Tips

- =ROWS(FILTER(A2:C100,C2:C100>500)) tells you how many records a filter returned.
- =ROWS($A$2:A2), filled down, numbers a list 1, 2, 3 and keeps working if the table moves.

## Related functions

- [COLUMNS](https://spreadsheetpractice.com/functions/columns): COLUMNS counts how many columns a range or array has, whether or not the cells contain anything.
- [ROW](https://spreadsheetpractice.com/functions/row): ROW returns the row number of a cell: ROW(C7) is 7, and ROW() with nothing inside returns the row of the cell the formula sits in.
- [COUNTA](https://spreadsheetpractice.com/functions/counta): COUNTA counts every cell that isn't empty: text, numbers, dates, errors and even formulas that return empty text.

## Questions

### How do I count the rows in a range?

=ROWS(A2:A100) counts every row in the range. To count only rows with data, use =COUNTA(A2:A100).

### What is the difference between ROW and ROWS?

ROW gives the row number of a cell. ROWS gives the number of rows in a range.

## Practice

A graded ROWS exercise ("Share of stores at target") is on [the ROWS page](https://spreadsheetpractice.com/functions/rows). It is checked instantly, then re-checked on changed data.

Lessons that use ROWS:

- [Lesson 10: PivotTables](https://spreadsheetpractice.com/learn/pivottables)

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
