How to Use the ROW Function in Google Sheets
=ROW([cell_reference]). With no argument, it uses the cell the formula is in.
What ROW does
ROW answers "which row is this?" It looks small, but it is a building block for automatic numbering, alternating patterns and formulas that need a position. Its sibling COLUMN does the same for columns, with column A as 1.
ROW syntax
=ROW([cell_reference])
Per Google's help page, cell_reference is optional. If you leave it out, the function uses the cell where the formula is entered. If the reference spans more than one row and the formula is not an array formula, only the row number of the first row is returned.
A step-by-step example
=ROW(A9)
This returns 9, the row number of cell A9. Google's own sample is the same formula.
Number rows automatically
Typed numbers go wrong when you insert or delete rows. A formula fixes that. If your data starts in row 2, with a header in row 1, put this in A2 and fill it down:
=ROW() - 1
In row 2 it returns 1, in row 3 it returns 2, and so on. Because the formula uses its own position, the numbering adjusts as rows move. For a one-formula list, SEQUENCE is another option, and ROW also works with OFFSET.
Common mistakes
- Forgetting the header row. Subtract the number of header rows.
- Expecting every row of a range. Without an array formula, only the first row comes back.
- Mixing up ROW and COLUMN. ROW counts down, COLUMN counts across.
Try it yourself
Type your formula into the box, starting with =, then press Check.
Exercise 1: Row of A9
Write a formula that returns the row number of cell A9.
Exercise 2: Automatic numbering
Your data starts in row 2. Write a formula, with no cell reference, that returns 1 when typed in row 2.
What to learn next
- OFFSET: shift a reference by rows and columns.
- SEQUENCE: generate a list of numbers.
- MATCH: find the position of a value.
Syntax and rules in this guide were checked against Google's ROW help page. See all guides.