ROW function
Returns the row number of a cell reference, or of the cell holding the formula if no reference is given.
Available in All versions of Excel, including Microsoft 365, Excel for the web and Excel for Mac
In every Excel versionWorks in Google Sheets
Syntax
ROW([reference])| Argument | What it means | |
|---|---|---|
reference | Optional | A cell or range. If omitted, ROW uses the formula's own cell. A multi-row range returns every row number as an array in Microsoft 365. |
Returns: A whole number: the row number on the worksheet.
How ROW works
ROW tells you which row a cell is on. =ROW(B7) returns 7, and =ROW() typed in A5 returns 5. That makes it a simple way to generate counters, numbered lists and alternating patterns without typing numbers by hand.
A common use is automatic numbering: =ROW()-1 in A2 returns 1, and copying it down gives 2, 3, 4... The numbers stay correct when you sort or delete rows, unlike typed numbers. ROW also helps conditional formatting (=MOD(ROW(),2)=0 shades every other row) and older array formulas that need a list of positions; in Microsoft 365, SEQUENCE is usually clearer for that. Pass a multi-row range and you get one number per row, which spills.
Examples
1Row number of an address
| A | |
|---|---|
| 1 | 7 |
Result: 7
Cell B7 is on row 7; the column is ignored.
2Automatic numbering
| A | B | |
|---|---|---|
| 1 | No. | Task |
| 2 | 1 | Order stock |
| 3 | Call supplier | |
| 4 | Send invoices |
Result: 1
In A2, ROW() is 2, so the formula shows 1. Copied down to A3 and A4 it shows 2 and 3, and it renumbers itself if a row is deleted.
3Array of row numbers
| A | B | C | |
|---|---|---|---|
| 1 | 2 | ||
| 2 | 3 | ||
| 3 | 4 |
A three-row range returns three row numbers that spill down C1:C3.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NAME? | A row number was typed without a column, like ROW(7). | Use ROW(A7) or ROW(7:7). |
Tips
- Subtract the header's row instead of a fixed number:
=ROW()-ROW($A$1)keeps working if you insert rows above the table. - For the number of rows in a range, use ROWS.
- Shade alternate rows with the conditional formatting rule
=MOD(ROW(),2)=0.
Google Sheets
ROW also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
ROW in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Czech | ŘÁDEK |
| Danish | RÆKKE |
| Dutch | RIJ |
| Finnish | RIVI |
| French | LIGNE |
| German | ZEILE |
| Hungarian | SOR |
| Italian | RIF.RIGA |
| Norwegian (Bokmål) | RAD |
| Polish | WIERSZ |
| Portuguese (Brazil) | LIN |
| Portuguese (Portugal) | LIN |
| Russian | СТРОКА |
| Spanish | FILA |
| Swedish | RAD |
| Turkish | SATIR |
Recipes that use ROW
- How to find the last value in a column in Excel
- How to get the nth match in Excel
- How to return multiple matches in Excel
- How to shade alternate rows in Excel
- How to sum only visible cells in Excel
- How to transpose rows and columns in Excel
- How to use conditional formatting with a formula in Excel