What is the ROW function?
=ROW([reference])ROW returns the row number of a cell. It returns a position, not the value in the cell.
If you omit the reference, it returns the row of the cell that holds the formula. That makes =ROW()-1 a common way to number a list.
ROW supplies "which row am I on" to a formula: running numbers, shading every other row, or taking every n-th row with INDEX. It returns a position rather than a value, so numbering fixes itself when rows are inserted or deleted.
Arguments
- reference
- Optional. The cell whose row number you want.
ROW examples
Example 1. Row number
=ROW(C3)3.
Example 2. Number a list
=ROW()-1Put it in row 2 and copy down for 1, 2, 3…. Numbers stay in order when you delete rows.
Example 3. What ROW returns
=ROW()Without an argument, it is the row of the cell holding the formula.
Formula Entered in Result =ROW(C3) anywhere 3 =ROW() A5 5 =ROW()-1 A2 1 =ROW()-ROW($A$1) A2 1 Example 4. Every third row
=INDEX($B$2:$B$100, (ROW(A1)-1)*3+1)Copied down, it returns B2, B5, B8 and so on.
Common mistakes
Expecting a value
ROW(C3) returns 3, not the value in C3.
Passing a range
In newer versions, ROW(C1:C3) returns several row numbers at once.
Numbers shift when a header row is added
=ROW()-1 assumes one header row. =ROW()-ROW($A$1) uses the header cell as the anchor and keeps working when rows are inserted above.
FAQ
- Column number?
- Use COLUMN.
- Number of rows?
- Use ROWS.
- Shade every other row?
- Use =MOD(ROW(), 2)=0 in conditional formatting.