Excel ROW Function

The Excel ROW function returns the row number of a reference.

Syntax

=ROW ([reference])

Arguments

Reference (optional): It is the cell or a range of cells you want to get the row number.

• If the reference parameter is omitted, it assumes that the reference is the cell address in which the ROW function currently appears.
• If the reference is a range of cells which entered as vertical array (says =ROW(F5:F10)), it will return the row number of the first cell in the range (the result will be 5).
• The reference can’t include multiple references or addresses.

Return value

The ROW function will return a number which representing the row of a reference.

Examples

The ROW function is very simple and easy to use in our Excel daily work. This section is going to show you some examples of ROW function to help you easily understand and use it in the future.

Example 1: The basic usage of ROW function in Excel

Select a cell and enter formula =ROW() into it will get the row number of this cell immediately.

As the below screenshot shown, copy the below formula into cell E3 will return the result as number 3.
=ROW()

If specify a cell reference in the ROW function, such as =ROW(G103), it will return the row number 103 as below screenshot shown.

Example 2: Automatically number rows in Excel with ROW function

The ROW function can help to automatically number rows, and the created serial numbers will be updated automatically when adding or deleting rows from the range. See the below demo:

1. Supposing you want to start your serial numbers from 1 in cell A2, please select the cell and copy the below formula into it and press the Enter key.
=ROW()-1

Note: If the beginning cell is A5, apply this formula =ROW()-4. Please subtract the row number above the current cell from where you are starting the serial number.

2. Keep selecting cell A2, drag the Fill Handle across the rows to create the series you need. See screenshot:

Example 3: highlight every other row (alternate rows) in Excel with ROW function

In this example, we explain how to shade every other row (alternate rows) in Excel by using the ROW function. Please do as follows.

1. Select the range you want to apply color to the alternate rows, click Conditional Formatting > New Rule under the Home tab. See screenshot:

2. In the New Formatting Rule dialog box, you need to:

• 2.1) Select the Use a formula to determine which cells to format option in the Select a Rule Type box;
• 2.2) Enter formula =MOD(ROW(),2)=0 into the Format values where this formula is true box;
• 2.3) Click the Format button to specify a Fill color;
• 2.4) Click the OK button. See screenshot:

Note: The formula =MOD(ROW(),2)=0 means that all even rows in the selected range will be highlighted with certain fill color. If you want to shade all odd rows in the selected range, please change the 0 to 1 in the formula.

Then you can see all even rows in selected range are highlighted immediately.

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

 🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions… Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ... Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup... Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List... Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Columns to Select Same & Different Cells ... Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ... Top 15 Toolsets:  12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

• One second to switch between dozens of open documents!
• Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
• Increases your productivity by 50% when viewing and editing multiple documents.
• Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.