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
Typing =ROW()-1 in cell A2 of Google Sheets to number the first data row as 1
=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.

A numbered No. column showing 1 to 5 next to a list of tasks in Google Sheets
The No. column stays 1, 2, 3… even after you sort or delete rows.

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)

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.

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.