
Count how many rows are in a range or array. ROWS is useful for measuring range size, building counters, and checking table limits.
The ROWS function returns the number of rows in a range or array. If a range is 15 rows tall, ROWS returns 15. It does not care whether the cells are full, empty, or contain formulas. It only counts the size of the range.
That makes ROWS useful when a formula needs to know how tall a range is. It is often used for table size checks, expanding counters, spill-range measurements, and formulas that need to stay inside the limits of a source range.
Useful when a formula needs the height of a range instead of the row number of one cell.
Returns a whole number such as 1, 15, or 1048576.
=ROWS(array)
The function needs one argument: the range or array you want to measure. For example, =ROWS(A1:A15) returns 15. If the range is horizontal, like A1:Z1, the result is 1 because there is only one row.
ROWS can also work with array constants and spilled ranges, which makes it useful in newer Excel formulas as well as older worksheet patterns.
The argument is required. Unlike ROW(), ROWS does not default to the current cell. It always needs a range or array to count. That is because the function is answering a size question, not a position question.
ROWS is about size. Related functions answer different questions.
| Function | Main Question | Returns | Use When |
|---|---|---|---|
ROWS |
How many rows are here? | Count | You need the height of a range |
ROW |
Which row is this? | Position number | You need a row index, not a count |
COLUMNS |
How many columns are here? | Count | You need the width of a range |
COUNTA |
How many non-empty cells are here? | Count | You want to count entries, not physical row size |
The most direct use of ROWS is measuring the height of a range. A formula can use that count to display table size, check whether a result has the expected number of rows, or decide how far another formula should go.
ROWS is also a common way to build a running counter. A formula like =ROWS($A$1:A1) returns 1 in the first row, then 2, then 3 as the formula is copied down. Because the second reference expands, the count grows with it. This is a simple and reliable numbering pattern.
Another useful pattern is boundary checking. If a formula depends on a row number staying inside a source range, ROWS can tell you the maximum allowed size first. That makes it useful in INDEX-based formulas and other setups where the range size matters just as much as the data inside it.
This formula returns the height of the range, not the number of filled cells. If the range runs from row 1 to row 15, ROWS returns 15. This is useful when a worksheet needs to know the physical size of a table.
=ROWS(A1:A15) // Returns 15
Count the number of rows in A1:C15. Formula: =ROWS(A1:C15).
When a formula spills into multiple rows, ROWS can measure the height of that live result with the # operator. That makes it useful in newer Excel models where the result size can change over time.
=ROWS(B1#) // Returns the current spill height
Count the number of rows in a full column. Formula: =ROWS(A:A).
ROWS also works with array constants. In {1,2;3,4;5,6}, there are three horizontal lines of data, so the function returns 3. This is useful when a formula contains a fixed array inside it.
=ROWS({1,2;3,4;5,6}) // Returns 3
Count the rows in the array {1,2;3,4;5,6}. Formula: =ROWS({1,2;3,4;5,6}).
The range $A$1:A3 starts at a fixed top cell and expands downward. That means ROWS returns 3 here. If the formula is filled down one more row, the range becomes taller and the result increases automatically.
=ROWS($A$1:A3) // Returns 3
Count how many rows are in B5:B25. Formula: =ROWS(B5:B25).
Tell your friends about this post