Example 1
The row number of a cell
B2 =ROW(C5)
Result: 5
C5 is in row 5. The column letter doesn't matter, only the row.
B2 =ROW(C5) returns 5
Returns the row number of a reference, or of the cell the formula is in. Use it for automatic numbering and for building row-based formulas.
Syntax
=ROW()
Every version of Excel, including Microsoft 365, Excel 2024, 2021, 2019, 2016 and earlier, Excel for the web and the mobile apps.
Try it
Edit the formula in B2 or change the inputs. The sheet recalculates as you type.
B2 =ROW(C5) returns 5
ROW returns a row number. =ROW(C5) returns 5, and =ROW() returns the number of the row the formula sits in. It looks too simple to matter, but it is the foundation of automatic numbering, alternating-row logic and many array formulas.
reference is optional.
=ROW(C5) returns 5.=ROW() returns the row of the cell holding the formula.=ROW(B3:B5), older versions of Excel return only the first row, 3. Microsoft 365 and Excel 2021 or later return all of them as an array, {3;4;5}, which spills into neighbouring cells. Inside a function such as SUMPRODUCT or INDEX, that array is what makes row-by-row calculations work.=ROW()-ROW($A$1) in the first row below a header gives 1, and fill-down gives 2, 3, 4, and so on. Anchoring on the header cell means the numbers stay correct if rows are added above the table. A fixed =ROW()-1 breaks when the header moves.=IF(MOD(ROW(),2)=0,"Even","Odd"), or the same test inside conditional formatting, picks out every other row.=ROW(C5)-ROW(C$1)+1 is the position of C5 within a list that starts at C1. It is useful inside INDEX when you build a formula that must keep working as rows are inserted.=ROW(A1) filled down gives 1, 2, 3, because the reference shifts as it is copied. Be aware that this goes wrong if someone deletes row 1.ROW tells you where something is on the sheet. ROWS tells you how many rows a range has, and COLUMN is the matching function for columns. If all you want is a list of numbers, SEQUENCE in Microsoft 365 is simpler than ROW tricks: =SEQUENCE(10) returns 1 to 10.
ROW reports the position on the sheet, not within a table. If someone inserts or deletes rows above your data, ROW values change, so a formula that uses ROW()-1 to mean "item number" breaks. Subtract the row of the header cell instead, as above. ROW also isn't volatile: it recalculates only when its reference moves.
C5. If you leave it out, ROW returns the row of the cell the formula is in. For a multi-row range, current Excel returns every row number as an array that spills.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
B2 =ROW(C5)
Result: 5
C5 is in row 5. The column letter doesn't matter, only the row.
B2 =ROW(C5) returns 5
Example 2
A5 =ROW()-ROW($A$1)
Result: 4
ROW() is 5 in A5, and the header row ROW($A$1) is 1, so the result is 4. Fill the formula from A2 down and the numbers run 1, 2, 3, 4. Anchoring on the header means rows added above the table don't break it.
A5 =ROW()-ROW($A$1) returns 4
Example 3
B2 =IF(MOD(ROW(),2)=0,"Even","Odd")
Result: Even
B2 is in row 2, an even row, so MOD(2,2) is 0 and the result is Even. Filled down, B3 shows Odd, B4 Even, and so on.
B2 =IF(MOD(ROW(),2)=0,"Even","Odd") returns Even
Example 4
C2 =ROW(A3:A5)
Result: 3; 4; 5
In Microsoft 365 and Excel 2021 or later, a multi-row reference returns an array of row numbers that spills down from C2. In Excel 2019 and earlier, you would get only 3.
C2 =ROW(A3:A5) returns 3; 4; 5
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In A2, number the first task using the row number, so that it shows 1, and fill it down to A7 so the list runs 1 to 6. Anchor on the header so it survives inserted rows above the table.
Answer in A2, then it fills down to A7.
=ROW()-1 as an item number breaks when someone inserts a row above the table or moves the header. Subtract the header cell's row instead: =ROW()-ROW($A$1).=ROW(A1) filled down gives 1, 2, 3 only while row 1 exists. If someone deletes row 1, the formulas turn into #REF!.#SPILL!. Wrap the range in INDEX or MIN to return one number.The row number of the cell that holds the formula. In B7, `=ROW()` returns 7.
Put `=ROW()-ROW($A$1)` in the first row under the header and fill down, where $A$1 is the header cell. For a simple list in Microsoft 365, `=SEQUENCE(10)` also works.
ROW returns the row number of a cell, such as 5 for C5. ROWS returns how many rows a range contains, such as 8 for A2:A9.
In Microsoft 365 and Excel 2021 or later, ROW of a multi-row range returns an array with one number per row, and it spills into the cells below. Use MIN(ROW(range)) for the first row only.
Tracks take you from the basics to modelling, one graded exercise at a time.