If items are deleted, the row numbers should respond accordingly.

The article below explains several options.

The best option for you will depend on what Excel version you use, and on your particular requirements.

Automatic row numbers with the fill handle

Row numbers with the Fill Handle

The examples below use formulas to automatically generate row numbers.

The trick is to enter the first two numbers to help Excel understand what you want.

The SEQUENCE function generates a list of sequential numbers thatspilldirectly on the worksheet.

Automatic row numbers with the fill handle

The challenge in this example is how to calculate the number of rows needed for the list or table.

One option is to subtract a different number from COUNTA.

This formula will continue to work as long as rows are not added or deletedabovethe first row of data.

Automatic row numbers with the fill handle

In the worksheet shown, the header is in row 4.

See this articlefor a detailed explanation.

In other words, we are asking INDEX for the first (upper left) cell in the range.

Automatic row numbers with the fill handle

The advantage of this formula is that it is portable.

It won’t break when the formula is moved, and it will work with any named range.

The array can be one dimensional, or two-dimensional, determined byrowsandcolumnsarguments.

Automatic row numbers with the fill handle

ROW Function

The Excel ROW function returns the row number for a reference.

For example, ROW(C5) returns 5, since C5 is the fifth row in the spreadsheet.

When no reference is provided, ROW returns the row number of the cell which contains the formula.

Automatic row numbers in an Excel table

you’re free to use INDEX to retrieve individual values, or entire rows and columns.

COUNTA does not count empty cells.

Excel formula: Add row numbers and skip blanks

Excel formula: Automatic row numbers in Table

Excel formula: Get relative row numbers in range

Excel formula: First row number in range

Excel formula: Basic outline numbering

Excel formula: Last n rows

Excel SEQUENCE function

Excel ROW function

Excel INDEX function

Excel COUNTA function

Article image

Article image