ROW Function

Excel Functions › Lookup & Reference

All Excel versions

The Excel ROW function returns the row number of a cell — either the cell you point it at, or the cell the formula lives in when you give it no argument at all. That second trick is the famous one: it powers row numbering that repairs itself when rows are deleted, alternating-row formats, and every-nth-row calculations. Its sibling COLUMN does the same job sideways.


Quick answer: =ROW(C7) returns 7. With no argument, ROW returns the row of the formula’s own cell:
=ROW()-1 // in row 2 returns 1, in row 3 returns 2 - self-repairing numbering
Delete a row in the middle of the list and the numbers close ranks automatically.

Syntax

=ROW([reference])
ArgumentDescription
referenceOptionalThe cell (or range) whose row number you want. Omit it and ROW returns the row of the cell containing the formula.

Given a multi-row range, ROW returns the row number of every row: in Excel 365/2021 =ROW(C5:C8) spills 5, 6, 7, 8 down the sheet. In older versions you’ll only see the first value unless the formula is used inside an array calculation.

ROW with and without a reference

Point ROW at any cell and it reports the worksheet row, whether or not the cell holds anything:

=ROW(C7) // returns 7
=ROW(AZ100) // returns 100 - the column never matters

Leave the argument out and ROW describes its own location. The numbered list below has =ROW()-1 in every cell of column A — row 2 shows 1, row 3 shows 2, and so on:

AB
1#Task
21Collect timesheets
32Approve invoices
43Update forecast
54Send status report
65Book training room
=ROW()-1 // entered in A2 and copied down

Because nothing is hard-coded, deleting the “Approve invoices” row instantly renumbers the list 1–4 with no gaps — something typed numbers can never do.

Try it: interactive ROW demo

Live demo

Type any cell address to see what ROW returns — then move an argument-free =ROW() around the sheet.

Result:
Result:

Practical uses: numbering, banding, every nth row

1. Numbering that survives deletions. Typed numbers leave gaps when rows are deleted. =ROW()-1 (subtract however many header rows sit above the list) always shows an unbroken sequence:

=ROW()-1 // list starts in row 2; for a list starting in row 5 use =ROW()-4

2. Alternating-row logic. Feed ROW to ISEVEN or MOD inside conditional formatting to shade every other row — banding that survives sorting and inserting:

=MOD(ROW(),2)=0 // as a conditional formatting rule: TRUE on even rows

3. Every nth row. Sum every 3rd row of a column by testing row positions:

=SUMPRODUCT((MOD(ROW(B2:B19)-ROW(B2),3)=0)*B2:B19) // sums B2, B5, B8, ...

4. Sequences inside formulas. Before SEQUENCE existed, ROW(INDIRECT("1:"&n)) was the standard way to generate the numbers 1 to n inside an array formula — you’ll still meet it in older workbooks. In Excel 365, prefer SEQUENCE.

Errors & common pitfalls

Pitfall: the offset is hard-coded. =ROW()-1 assumes exactly one header row. Insert a second header row above the list and every number shifts by one. Re-check the offset whenever the layout above your list changes.

Pitfall: ROW counts worksheet rows, not list items. ROW reports position on the sheet. If you need “position within a range”, use ROW()-ROW(first_cell)+1 or MATCH instead.

Pitfall: ROW vs ROWS. ROW returns a row number; ROWS returns a count of rows in a range. =ROW(A5:A8) gives 5 (or spills 5–8); =ROWS(A5:A8) gives 4.

#NAME? — misspelled function. Usually ROWS() typed with an argument ROW expected, or a typo like =ROW(C7 missing its parenthesis. ROW itself exists in every Excel version, so #NAME? always means a typing problem.

Practice workbook

📊
Download the free ROW practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What does =ROW() with no argument return?
The row number of the cell the formula is entered in. Type =ROW() in cell D7 and it returns 7. That makes it the engine behind self-repairing row numbering like =ROW()-1.
How do I number rows so the numbers survive deleting rows?
Put =ROW()-1 in the first data cell (for a list starting in row 2) and copy down. Each formula computes its number from its own position, so deleting a row renumbers everything instantly. Adjust the subtraction to match your header rows.
What's the difference between ROW and ROWS?
ROW returns a row number (position on the sheet); ROWS returns how many rows a range contains. =ROW(A5:A8) relates to position 5; =ROWS(A5:A8) is the count, 4.
Why does =ROW(A5:A8) show more than one number?
In Excel 365/2021, ROW on a multi-row range returns an array that spills: 5, 6, 7, 8. In older versions you see only the first value unless the formula is part of an array calculation. It's a feature, not a bug — many classic array formulas rely on it.
Can I use ROW to shade every other row?
Yes. Create a conditional formatting rule with the formula =MOD(ROW(),2)=0 and pick a fill. Even-numbered rows shade, and the banding survives sorting, inserting, and deleting — unlike manually painted fills.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: ROWS · COLUMN · ADDRESS · INDIRECT · MATCH