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.
Table of Contents
- 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 referenceCell ReferenceCell reference in excel is referring the other cells to a cell to use its values or properties. For instance, if we have data in cell A2 and want to use that in cell A1, use =A2 in cell A1, and this will copy the A2 value in A1.. A cell reference could be a single cell or a range of cells.
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.
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 atleast 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”.
Frequently Asked Questions (FAQs)
A few reasons the Rows Function may not work are,
a. We have entered the wrong function name.
b. We have not entered even a single argument value or cell reference. One argument is mandatory, unlike the Row function, which does not need any arguments.
A few reasons why ROWS function may not work are,
· We have used the function name as ROW instead of ROWS.
· We have not provided the cell reference to count the number of rows.
· We have given non-numeric value, and got a “#NAME?” error.
We can find the ROWS function as follows,
First, choose an empty cell – select the “Formulas” tab – go to the “Functions Library” group – click the “Lookup & Reference” option drop-down – select the “ROWS” function, as shown below.
This article is a guide to ROWS Function in Excel. Here we use formula to find count of number of rows in selected cell range, examples & downloadable template. You can learn more about Excel functions from the following articles: –
- VBA Last RowVBA Last RowThe End(XLDown) method is the most commonly used method in VBA to find the last row, but there are other methods, such as finding the last value in VBA using the find function (XLDown).
- Row HeaderRow HeaderExcel Row Header is the grey column on the left side of column 1 in the worksheet that contains the numbers (1, 2, 3, etc.). To hide or reveal row and column headers, press ALT + W + V + H.
- Convert Rows to Columns in ExcelConvert Rows To Columns In ExcelRows can be transposed to columns by using paste special method and the data can be linked to the original data by simply selecting ‘Paste Link’ form the paste special dialog box. It could also be done by using INDIRECT formula and ADDRESS functions.
- Convert Columns to Rows in ExcelConvert Columns To Rows In ExcelThere are two ways to convert columns to rows: 1) using the Excel Ribbon Method. 2) The Mouse Method.