Excel function

ROWSfunction

Counts the rows in a range.

All versions
=ROWS(B2:D6)
A
B
C
D
1
2
3
4
5
6

Drag the corner dots to change array. Make the range taller or shorter. Try breaking it on purpose to see the errors.

Result

5

array
B2:D6Drag the corner dots on the table

The range whose rows you count. Drag a corner to change it.

What is the ROWS function?

=ROWS(array)

ROWS counts how many rows a range has. It looks only at the size of the range, not whether cells are empty.

ROW and ROWS look alike, but ROW is a position and ROWS is a count.

ROWS only counts the rows in a range, but copied down it produces 1, 2, 3…, which makes it the usual way to feed the "k-th" argument of SMALL, LARGE or INDEX. Delete a row and the numbers close up on their own.

Arguments

array
The range whose rows you count.

ROWS examples

  1. Example 1. Number of rows

    =ROWS(B2:D6)

    Rows 2 to 6, so 5.

  2. Example 2. Running number

    =ROWS($A$2:A2)

    Copy down for 1, 2, 3….

  3. Example 3. List scores from low to high

    =SMALL($B$2:$D$6, ROWS($A$1:A1))

    Copied down, ROWS gives 1, 2, 3, so the 1st, 2nd and 3rd smallest scores appear in order.

    Copied toROWS($A$1:A1)Result
    1st row176
    2nd row278
    3rd row384
  4. Example 4. Value in the last row

    =INDEX(A2:A10, ROWS(A2:A10))

    Returns the last cell of the range (A10) without editing the formula when the range grows.

Common mistakes

FAQ

Number of columns?
Use COLUMNS.
Total number of cells?
=ROWS(range)*COLUMNS(range).
The last row that has data?
Count filled cells with COUNTA instead of ROWS.