Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Working with Record Numbers.

# Working with Record Numbers

by Allen Wyatt
(last updated November 1, 2016)

For some data tables in Excel, you may want to assign a record number to cells in a particular column. For instance, you might want record numbers for 20 different records, ranging between 1 and 20 or between 100 and 119. It doesn't really matter to Excel what range you select. How you go about setting up the record numbers depends on what you want to later do with them.

If you want the record numbers to be static—that is, they are always assigned to a particular record and never change—then you should use the AutoFill feature of Excel to assign the numbers. To do this, simply enter all your data except the record numbers. Then type in the first two or three record numbers, select them, and drag on the AutoFill handle (the black square at the bottom-right corner of the selection) to fill out the rest of the records.

Using this approach is fast and easy, but it does make the record numbers static. For instance, if you delete the record that has a record number of 107, then that particular record number is gone, and your numbers will show a gap, jumping from 106 to 108.

If you want dynamic record numbers—ones that will change as you make deletions—then you can use a formula to calculate the record numbers. You could put the first record number in, for instance, cell A5, and then in the next cell down you would use a formula such as =A5+1 to calculate the new record number.

This still presents a problem, however, because if you delete a record, all the record numbers below the one you deleted will show an error (#REF!). Why? Because you delete a cell on which the next cell down was dependent. A better solution is to use a record number formula that is dependent on the row in which the formula is located. For instance, let's assume your first record is in row 5. You could use this formula to generate a range of record numbers starting with 100:

```=ROW()+95
```

Now, if you delete a record, the remaining record numbers readjust themselves and you don't end up with any errors.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2085) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Working with Record Numbers.

##### Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

##### MORE FROM ALLEN

Last Non-Zero Value in a Row

If you have a lot of values in a single row, you might want to pull the last non-zero value from that row. There are a ...

Discover More

Controlling Names of Backup Files

Want to control the name and location of your document backup? Here are some ideas that may help.

Discover More

Creating Labels

Using Word to create and print labels is a snap. All you need to do is provide the text you want on the labels, pick a ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

Enhanced Filling

Using the AutoFill feature of Excel is very handy. If you want to expand the utility offered by the feature, all you need ...

Discover More

Using the Fill Handle from the Keyboard

The fill handle can save a huge amount of time when you are editing a worksheet. If you are really good at using the ...

Discover More
##### Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. Youâ€™ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five more than 3?

There are currently no comments for this tip. (Be the first to leave your commentâ€”just use the simple form above!)

##### This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.