How to Number Rows Automatically in Google Sheets

By Gerard Fernandez · Updated · 2 min read

Typing 1, 2, 3 by hand is fine until you insert or delete a row and the whole column is wrong. A formula-based number list renumbers itself automatically, so it always stays in order. Here are the best ways to do it.

The ROW function

ROW returns the row number of a cell. If your data starts in row 2 (row 1 is the header), put this in A2:

=ROW()-1
Google Sheets No. column with =ROW()-1 in A2, numbering five tasks from 1 to 5
Real test: =ROW()-1 turns row 2 into number 1, row 3 into 2, and so on.

Copy it down the column. Because the number comes from the row position, deleting or inserting rows renumbers everything instantly. In our test we deleted row 4 (Order food):

The same list after deleting the Order food row: the No. column now reads 1, 2, 3, 4 with no gap
Real test: after deleting a row, the No. column still reads 1, 2, 3, 4, with no gap.

Only number rows that have data

A plain =ROW()-1 shows a number even on empty rows. To leave blank rows blank, check the neighbouring cell first:

=IF(B2="", "", ROW()-1)

In our test, this formula left row 6 empty until we typed a new task in B6; then it showed 5.

Number a whole column at once with SEQUENCE

Instead of copying a formula down, one SEQUENCE formula can fill the whole list. In A2:

=SEQUENCE(COUNTA(B2:B))

COUNTA(B2:B) counts how many rows have data in column B, and SEQUENCE produces 1, 2, 3… up to that number. Add rows to column B and the numbering grows on its own: in our test it went from 1–4 to 1–5 as soon as we added a fifth task.

The quick autofill way (no formula)

If you don't need it to update automatically:

  1. Type 1 in the first cell and 2 in the one below.
  2. Select both cells.
  3. Drag the small blue square at the bottom-right corner down the column. Sheets continues 3, 4, 5…

Difference: autofill writes fixed numbers, so they don't renumber when you delete a row. Use a formula if the list changes often.

Frequently asked questions

How do I restart numbering partway down?

Subtract the row above your new start. If a new section starts in row 10, use =ROW()-9 from there.

Why does my number column sort wrongly?

ROW numbers follow the row position, so after sorting they stay 1, 2, 3 from the top, which is usually what you want. If you need a number that travels with the row, use autofill (fixed numbers) instead.

Can I add a label like "Item 1"?

Yes: ="Item "&(ROW()-1) produces Item 1, Item 2, and so on.