What is ROW function in Excel?
The ROW function is one of the Excel Lookup & reference functions.
It returns the ROW number of a reference.
We can find this function in Lookup & reference of insert function Tab.
How to use row function in excel
- Click on empty cell (like F5 )

2. Click on the fx icon (or press shift+F3)

3. In the insert function tab you will see all functions

4. Select Lookup & reference category
5. Select ROW function
6. Then select ok

7. In the function arguments Tab, you will see ROW function
8. In the Reference section you can enter the cell or a single range of cells that you want the ROW number.
9. If you click on G4, see result 4

10. If you click on A2, see result 2

11. You will see the result in formula result section
Examples of ROW function in excel
Example 1: How to Automatic row numbering in the Excel
We can use ROW function if we want to number a set of data in Excel.
First, suppose we have data as shown in the image below:

We can automatically number cells 2 to 10 by the ROW function, By Typing =ROW()-1 in cells.

Example 2: How to Highlight Every other Row in the Excel
If we want Highlight Every other Row in Excel, we can combine ROW, MOD and Conditional formatting:
1. Select column A
2. In Home Tab, Choose Conditional formatting.(Press ALT+H+L)
3. Select New Rule. (Press ALT+H+L+N)

4. In New Formatting Rule Tab, Select Use a Formula to determine Which Cells To Format.
5. In formula box, Type =MOD(ROW(),2)=1
6. Select Format

7. In the Format cell Tab, Select Fill.
8. In Fill Tab, Select your Color.
9. Finally Select ok.

Example 3: HOW to Generate Specific Serial Number in Excel
If we want Generate Specific Sequential Serial numbers in Excel, we can combine ROW and Text:
1. Choose your format text (ex: “00-00-0000”)
2. Type in cell A2 =TEXT(ROW(A2)-1,”00-00-0000″)
3. Drag the fill handle to the last cell of the range.

Things to Remember
- The argument of this function is required and not optional
- If a reference is omitted, the cell containing the ROW function is used.
- This function is available for all excel versions(2007-2019)
Python code for ROW function
Name | Age | Height | Weight |
Olivia | 25 | 210 | 180 |
Noah | 25 | 205 | 235 |
Oliver | 27 | 195 | 205 |
Elijah | 22 | 198 | 185 |
James | 29 | 199 | 231 |
William | 29 | 201 | 240 |
Benjamin | 21 | 202 | 235 |
Lucas | 25 | 200 | 238 |
Henry | 22 | 204 | 190 |
import pandas as pd
df=pd.read_csv(‘example.csv’)
maxrow=df['Name'].notna().sum()
print (maxrow)
ROW related functions :
- Column function
- Indirect function
- Offset function
- SMALL function