Author: Oscar Cronquist Article last updated on April 19, 2022

The ROWS function allows you to calculate the number of rows in a cell range.

The example above shows that cell range B3:B10 contains 8 rows.

1. ROWS Function Syntax

ROWS(array)

Back to top

2. ROWS Function Argument

array Required. A cell range for which you want to calculate the number of rows.

Back to top

3. ROWS Function Example

ROWS function example

Formula in cell D3:

=ROWS(B3:B10)

Back to top

4. Count rows in an array

ROWS function count rows in an array

The ROWS function also calculates the number of rows in an array.

Formula in cell B3:

=ROWS({20,95,67; 13,14,58; 96,74,28; 7,64,22})

The array has four rows. The ; (semicolon) character is a row delimiting character in an array.

Back to top

5. Count rows based on a condition

ROWS function condition

Formula in cell E3

=ROWS(FILTER(B3:B10,B3:B10=D3))

Explaining formula

Step 1 - Logical expression

B3:B10=D3

Step 2 - Filter values based on a condition

FILTER(B3:B10,B3:B10=D3)

Step 3 - Count rows

ROWS(FILTER(B3:B10,B3:B10=D3))

Back to top

6. Count rows based on a list

ROWS function based on a list

Formula in cell F3:

=ROWS(FILTER(C3:C11,COUNTIF(E3:E4,C3:C11)))

Explaining formula

Step 1 - Which values equals any item in the list

COUNTIF(E3:E4, C3:C11)

Step 2 - Filter values based on array

FILTER(C3:C11,COUNTIF(E3:E4,C3:C11))

Step 3 - Count rows

ROWS(FILTER(C3:C11,COUNTIF(E3:E4,C3:C11)))

Back to top

7. Count rows in a delimited string

ROWS function string

Excel 365 dynamic array formula in cell C3:

=ROWS(TEXTSPLIT(B3,,";"))

Explaining formula

Step 1 -

TEXTSPLIT(B3,,";")

Step 2 -

ROWS(TEXTSPLIT(B3,,";"))

Back to top

8. Count rows in multiple cell ranges

ROWS function multiple cell ranges

Formula in cell B12:

=ROWS(VSTACK(B3:B9,D3:D7,F3:F5))

Explaining formula

Step 1 - Join arrays

VSTACK(B3:B9,D3:D7,F3:F5)

Step 2 - Calculate rows

ROWS(VSTACK(B3:B9,D3:D7,F3:F5))

Back to top