Table Of Contents
What Is Excel ROWS Function?
The ROWS function in Excel returns the count of the number of rows selected in the range. It is also a referencing function to identify the number of rows in a given array.
The Excel ROWS function is different from the ROW function because, the ROW function gives us the row number for the selected cell, and the ROWS function takes an array of rows as an argument and provides us with the number of rows in that array.
For example, =ROWS(A1:A3) returns 3, since the range A1:A3 contains 3 rows, and =ROWS(A1:C1) returns 1, since the range A1:C1 contains a row, as shown below.
Key Takeaways
- The ROWS function in Excel, different from the ROW function, helps us find the count of the rows of the cells selected, irrespective of the data values on the selected rows. The function only gives us the row count.
- It accepts only one argument, i.e., a cell range or an array. If we select multiple cell ranges or type multiple arguments within the formula, we will get an error, and the formula will not execute.
- Since the ROWS function is an inbuilt function, we can insert the formula from the Function Library or enter it directly in the worksheet.
How To Use ROWS Function In Excel?
We can use the ROWS function In Excel using the following syntax,
The ROWS function has only one argument, i.e., the array, which is nothing but a cell reference. A cell reference could be a single cell or a range of cells.
Examples
We will consider examples using the ROWS function in Excel.
Example #1 - Using Row Cell Reference
Let us look at the simple example of the ROWS function.
In cell B3, we will open the ROWS function. Then, we will give the cell reference as A1 in an array argument.
We will close the bracket, and press the “Enter” key to see what we get.
Since we selected only one cell, it returned the result as 1.We will change the cell reference from A1 to A1: A3.
Now, close the formula, and press “Enter” to see the result.
The output now is 3.
We got the result as 3 because we looked closely at the cell reference. It says A1:A3, i.e., three rows are selected in the range of cells.
Example #2 - Using Column Cells Reference
The ROWS function counts how many rows are selected in the reference. Now, we will apply the formula in cell B3, as shown below.
We have given the cell reference as A1:C1. So, let us see what the result is.
Even though we have selected 3 cells, we still got the result as 1 only!
It is because we have selected 3 cells in the same row, i.e., different column cells. Since we chose the range of cells in the same row, we only got the result of 1.
So, the ROWS formula cannot count COLUMNS in excel here.
Example #3 - Count of Rows
The ROWS function counts only how many rows are in the reference. Now, look at this example.
We have given the cell reference as A4, i.e., the 4th row of the worksheet. Press the “Enter” to see the result.
The result is 1, even though we have selected the 4th row of the worksheet.
As we told in the beginning, the ROWS function does not return row numbers. Rather, it returns only the count of selected rows. Since we have chosen only one row, the result is 1, not 4.
Example #4 - Insert Serial Numbers
We can use the ROWS function to insert serial numbers from 1. For example, we usually insert serial numbers from cell A2, so we will show you how to insert serial numbers with the ROWS formula in Excel.
Open the ROWS function in cell A2.
Select the cell reference as A2: A2.
For the first cell, the reference refers as absolute. $A$2: A2.
Now, press the “Enter” key. Then, we should get the result as 1.
Now, drag the formula down to get the serial numbers.
Since we have made the first part of the cell reference as an absolute cell reference, it remains the same when we drag it down, but another cell part keeps changing from A2 to A3, A3 to A4, and so on.
Difference Between ROW & ROWS
After knowing the ROWS function, it is important to understand how it differs from the ROW function in Excel.
The ROW function returns the row number of the selected cell in the worksheet, with or without a cell reference. For example, we choose the empty cell with the cell address A3, by using the ROW function.
Since A3 is the third row in the worksheet, we got the result as 3.
But on the other hand, if we insert the same cell reference using the ROWS function.
We will get the result as 1.
Because the Excel ROWS function returns the count of rows that are selected in the range.
Therefore, the ROW function returns the row number of the selected cell, and the ROWS function returns the count of selected rows in Excel.
Important Things To Note
- We must ensure to enter at least one cell reference, or else we will get the “#NAME?” error.
- Irrespective of the cell values selected, the ROWS function returns the count of the number of rows selected.
- We must enter only one array, or cell range. Multiple sets of cell ranges give an error as “Too many arguments entered”.