ROWS Function

Excel Functions › Lookup & Reference

All Excel versions

The Excel ROWS function counts how many rows a range or array contains — empty or not. It sounds almost too simple to matter, but it quietly powers some genuinely useful patterns: counting how many results FILTER returned, running counts that survive sorting, and size checks before array math. Its sideways twin is COLUMNS; don’t confuse it with ROW, which returns a position rather than a count.


Quick answer: to count the rows in a range:
=ROWS(A2:A100) // returns 99
ROWS counts cells in the reference, full or empty. To count non-empty entries, use COUNTA instead.

Syntax

=ROWS(array)
ArgumentDescription
arrayRequiredA range, array, or array formula whose rows you want to count.

It counts geometry, not content. =ROWS(A2:A100) is 99 whether those cells hold data, formulas, or nothing at all. That makes ROWS predictable — and makes COUNTA the right tool when you want “how many entries”.

Counting rows in ranges and arrays

The orders table below occupies A1:C7 — one header row plus six data rows (highlighted):

ABC
1Order IDCustomerAmount
21001Acme Corp$1,850
31002Bolt LLC$920
41003Cedar Inc$2,400
51004Delta Co$1,310
61005Echo Ltd$480
71006Foxtrot$3,175
=ROWS(A2:C7) // returns 6 - the data rows
=ROWS(A1:C7) // returns 7 - header included

ROWS happily measures whole columns and arrays you type in directly:

=ROWS(A:A) // returns 1,048,576 - every row on a worksheet
=ROWS({1;2;3;4}) // returns 4 - semicolons separate rows in array constants

Try it: interactive ROWS demo

Live demo

Pick a range and see what ROWS returns — note how the column letters never affect the answer.

Result:

Practical uses: counting results, running counts, size checks

1. How many rows did FILTER return? Dynamic array results vary in size; wrap them in ROWS to count matches:

=ROWS(FILTER(A2:C100, C2:C100>1000)) // how many orders over $1,000

2. Running counts that survive sorting. Anchor the first cell and let the second expand as you copy down — a numbering trick many pros prefer to ROW because it ignores where the list sits on the sheet:

=ROWS(B$2:B2) // copy down: returns 1, 2, 3, ... regardless of header rows above

3. Last-row lookups. Pair ROWS with INDEX to fetch the bottom entry of a fixed-size range:

=INDEX(B2:B25, ROWS(B2:B25)) // the last cell of the range

4. Sanity-check array math. Two ranges multiplied inside SUMPRODUCT must be the same height. A quick audit cell catches mismatches before they become silent errors:

=ROWS(B2:B50)=ROWS(D2:D50) // TRUE means safe to combine

Errors & common pitfalls

Pitfall: ROWS is not a data count. It measures the reference, not the contents. =ROWS(A2:A100) is always 99 even if only 12 cells are filled. Use COUNTA(A2:A100) to count entries, or point ROWS at a dynamic result like a FILTER spill.

Pitfall: ROWS vs ROW. ROW answers “where is it?”; ROWS answers “how many?”. =ROW(A5:A8) relates to position 5; =ROWS(A5:A8) is 4. Mixing them up is the most common bug in numbering formulas.

Pitfall: counting a spill? Reference the spill. If a FILTER formula in E2 spills results, count them with =ROWS(E2#) — the # grabs the whole spilled range. =ROWS(E2) is just 1.

#CALC! passed through. =ROWS(FILTER(...)) shows #CALC! when FILTER finds nothing and has no if_empty argument. Either give FILTER an if_empty value or wrap the whole thing in IFERROR.

Practice workbook

📊
Download the free ROWS practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What's the difference between ROWS and COUNTA?
ROWS counts the cells a reference covers, full or empty; COUNTA counts non-empty cells. =ROWS(A2:A100) is always 99; =COUNTA(A2:A100) tells you how many of those cells actually contain something.
What's the difference between ROWS and ROW?
ROW returns a position (the worksheet row number); ROWS returns a count (how many rows a range spans). =ROW(A5:A8) relates to 5; =ROWS(A5:A8) is 4.
How do I count how many results FILTER returned?
Wrap it: =ROWS(FILTER(range, criteria)). If the FILTER result is already spilling from, say, E2, count it with =ROWS(E2#). Add an if_empty argument to FILTER (or IFERROR around ROWS) so zero matches doesn’t show #CALC!.
What does =ROWS(A:A) return?
1,048,576 — the total number of rows on a modern Excel worksheet (since Excel 2007). It's a handy way to demonstrate that ROWS measures the reference, not the data in it.
How does =ROWS(B$2:B2) create a running count?
The first corner is locked with $ and the second is relative. Copied down one row the reference becomes B$2:B3, then B$2:B4 — a range that grows by one row each time, so ROWS returns 1, 2, 3, … independent of where the list starts.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: ROW · COLUMNS · FILTER · INDEX