The ROW function
Returns the row number of a cell. Left empty, it returns the row of the cell the formula is in.
Syntax
ROW([reference])- reference (optional)
- The cell to get the row number of. Left out, the formula's own cell.
Examples
B1=ROW(C7)
| A | B | |
|---|---|---|
| 1 | 7 |
A4=ROW()-1
| A | B | |
|---|---|---|
| 1 | Name | |
| 2 | Ann | |
| 3 | Ben | |
| 4 | 3 | Cy |
B6=IF(MOD(ROW(),2)=0,"Even row","Odd row")
| A | B | |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | Even row |
Read the guide
Questions
How do I number rows automatically?
In row 2, type =ROW()-1 and fill it down. The numbers stay right when you delete or insert rows. In Excel 365 you can also spill them with SEQUENCE.
What is the difference between ROW and ROWS?
ROW returns the row number of a cell, so ROW(C7) is 7. ROWS counts the rows in a range, so ROWS(C2:C7) is 6.