What Is ROW Function In Excel?
The ROW Function in Excel is used to find the row number of a cell reference or a cell range, and not its value. In a large dataset the function quickly finds the row index. The ROW Function in Excel is an inbuilt function, so we can enter it as a formula or insert it from the Function Library, Lookup & Reference group.
For example, the following table contains a requirements list for what row number should get displayed in each cell in the cell range B2:B4.
Frequently Asked Questions (FAQs)
The ROW function in Excel is in the Formulas tab. Click Formulas 🡪 Lookup & Reference 🡪 ROW to access it.
The ROW function in Excel might not work due to the following reasons:
● The specified cell or cell range is invalid.
● Multiple references are provided as the argument to the ROW function.
● We provided an argument that is not a proper cell reference.
We can execute the ROW function in Excel VBA, using the below steps as shown in the following example.
The following table shows a list of products and their prices.
The steps to find the row number of each product using the ROW function and the Excel VBA are:
1: In the worksheet with the above table, press the shortcut keys Alt + F11 to open the “VBA Editor”.
2: Click on the required VBAProject in the menu on the left (as depicted in the image above) and select Insert 🡪 Module to open a new module window.
3: Once the Module 1 window opens, type the VBA code, shown in the below image, to display the required row numbers in the target cells C2:C6.
Sub Excel_ROW_Fn()
Dim rn As Worksheet
Set rn = Worksheets(“ROW_FAQ”)
rn.Range(“C2”) = rn.Range(“A2”).Row
rn.Range(“C3”) = rn.Range(“A3”).Row
rn.Range(“C4”) = rn.Range(“A4”).Row
rn.Range(“C5”) = rn.Range(“A5”).Row
rn.Range(“C6”) = rn.Range(“A6”).Row
End Sub
4: Next, click the Run Sub/UserForm option in the menu to execute the commands.
5: Finally, open the worksheet to view the output with the row numbers displayed in column C.
Likewise, suppose we have to show the row number of a cell range, say A2:C6, in the target cell C6. Then the VBA code will be as shown in the image below:
Sub Excel_ROW_Fn()
Dim rn As Worksheet
Set rn = Worksheets(“ROW_FAQ”)
rn.Range(“C2”) = rn.Range(“A2”).Row
rn.Range(“C3”) = rn.Range(“A3”).Row
rn.Range(“C4”) = rn.Range(“A4”).Row
rn.Range(“C5”) = rn.Range(“A5”).Row
rn.Range(“C6”) = rn.Range(“A2:C6”).Row
End Sub
And the new output will be:
Cell C6 shows row number 2, the topmost row in the cell range, A2:C6.
The difference between the ROW and ROWS functions in Excel is that the ROW() function gives the row number of the specified cell or cell range reference. On the other hand, the ROWS() function determines the number of rows in the specified reference as a number.
Download Template
📥Download the ready-to-use Excel template to practice this tutorial yourself.
Download Excel TemplateRecommended Articles
This has been a guide to ROW Function in Excel. Here we use formula with MOD, INT, HLOOKUP, INDEX, MATCH, formatting, examples & downloadable excel template. You can learn more from the following articles –