Serial Number Formula In Excel

Active2 years, 1 month ago

Numbering means giving serial numbers or numbers to a list or a data. In excel there is no special button provided which gives numbering for our data. As we already know excel does not provide a method or tool or a button to give the sequential number to a list of data, which means we need to do this by ourselves. While we are working in Excel, we often come across to number rows in a dataset stored in Excel. The most common way to do this is by entering serial numbers manually. But what if you are having thousands of rows? And you keep adding and removing rows in.

I have so many records but I need to enter serial numbers automatically in Excel 2007. I have hundreds of records. Instead of entering them manually I want them to show up automatically. Please give me short example for 1 to 10.

Aruna
10.5k3 gold badges20 silver badges38 bronze badges
vishal_gvishal_g
2,6844 gold badges15 silver badges31 bronze badges

9 Answers

you need to fill only starting 2-3 numbers (or text for that matter) and then drag the range down using fill handle. MS Excel will identify the series by itself and will fill the range till where you drag down the range. The below image shows the ‘Fill Handle’.

vishal_gvishal_g
2,6844 gold badges15 silver badges31 bronze badges

Enter the formula =ROW() into any cell and that cell will show the row number as its value.

If you want 1001, 1002 etc just enter =1000+ROW()

hawbslhawbsl
7,99221 gold badges64 silver badges102 bronze badges

If you want to pick cell entries from a list then you have a couple of non-code based options

  • Data Validation, which is very well covered at Debra Dalgleish's site
  • Excel's autocomplete feature

I would recommend The Data Validation approach where

  • creating a list of your 100 records in a single column,
  • provide a range name to this list,
  • then using Data Validation's List option

sample from Debra's site below, click on the first link above to access it.

brettdjbrettdj
49.6k16 gold badges99 silver badges159 bronze badges

Simple Answer:

In A1

In A2

copy this down the column. Each time an entry is entered in column B the next number in order will be entered in column A.

Suppose you want the answer of 2 in a4 cell because of your heading & other stuff, you can write as

Matt
35.6k7 gold badges45 silver badges74 bronze badges
Yogendra.CYogendra.C

Enter the first in the series and select that cell, then series fill (HOME > Editing - Fill, Series..., Columns):

It is very fast and the results are values not formulae.

pnutspnuts
51k7 gold badges66 silver badges105 bronze badges

=IF(B1<>',COUNTA($B$1:B1)&'.',')

Using formula

  1. Paste the above formula in column A or where you need to have the serial no
  2. When the second column (For Example, when B column is filled the serial no will be automatically generated in column A).
JeloeyaveJeloeyave

I find it easier using this formula

Need to paste this formula at A2, that means when you are encoding data at B cell the A cell will automatically input the serial code and when there's no data the cell will stay blank....you can change the 'IR' to any first letter code you want to be placed in your row.

Hope it helps

Halvor Holsten Strand
16.7k15 gold badges60 silver badges74 bronze badges
user4670928user4670928

I have a very simple answer. Just put this formula in cell A2:

and fill down.

This sets row number automatically, even if you remove some rows or sort rows.

Avazbek IsmanovAvazbek Ismanov

Use formula =row(b2)-x, where x will adjust the entries so that the first S/No is marked as 1 and will increment with the rows.

Hira Bilala Yusuf KHANHira Bilala Yusuf KHAN

Not the answer you're looking for? Browse other questions tagged excelexcel-2007 or ask your own question.

Watch Video – 7 Quick and Easy Ways to Number Rows in Excel

When working with Excel, there are some small tasks that need to be done quite often. Knowing the ‘right way’ can save you a great deal of time.

One such simple (yet often needed) task is to number the rows of a dataset in Excel (also called the serial numbers in a dataset).

Now if you’re thinking that one of the ways is to simply enter these serial number manually, well – you’re right!

Auto Serial Number Formula In Excel

But that’s not the best way to do it.

Imagine having hundreds or thousands of rows for which you need to enter the row number. It would be tedious – and completely unnecessary.

There are many ways to number rows in Excel, and in this tutorial, I am going to share some of the ways that I recommend and often use.

Of course, there would be more, and I will be waiting – with a coffee – in the comments area to hear from you about it.

How to Number Rows in Excel

The best way to number the rows in Excel would depend on the kind of data set that you have.

For example, you may have a continuous data set that starts from row 1, or a dataset that start from a different row. Or, you might have a dataset that has a few blank rows in it, and you only want to number the rows that are filled.

You can choose any one of the methods that work based on your dataset.

1] Using Fill Handle

Fill handle identifies a pattern from a few filled cells and can easily be used to quickly fill the entire column.

Suppose you have a dataset as shown below:

Here are the steps to quickly number the rows using the fill handle:

  • Enter 1 in cell A2 and 2 in cell A3.
  • Select both the cells (A2 and A3).
  • Note that there would be a small square at the bottom-right of the selection.
  • Hover the cursor over this square, and you will notice that the cursor changes to a plus icon.
  • Double-click on the fill handle square (while the cursor is in the plus icon form) and it will automatically fill all the cells until the end of the dataset.

Note that Fill Handle automatically identifies the pattern and fill the remaining cells with that pattern. In this case, the pattern was that the numbers were getting incrementing by 1.

In case you have a blank row in the dataset, fill handle would only work till the last contiguous non-blank row.

Also, note that in case you don’t have data in the adjacent column, double-clicking the fill handle would not work. You can, however, place the cursor on the fill handle, hold the right mouse key and drag down. It will fill the cells covered by the cursor dragging.

2] Using Fill Series

While Fill Handle is a quick way to number rows in Excel, Fill Series gives you a lot more control over how the numbers are entered.

Suppose you have a dataset as shown below:

Here are the steps to use Fill Series to number rows in Excel:

  • Enter 1 in cell A2.
  • Go to the Home tab.
  • In the Editing Group, click on the Fill drop-down.
  • From the drop-down, select ‘Series..’.
  • In the ‘Series’ dialog box, select ‘Columns’ in the ‘Series in’ options.
  • Specify the Stop value. In this case, since we have 26 records, we can enter 26. If you don’t enter any value, Fill Series will not work.
  • Click OK.

This will instantly number the rows from 1 to 26.

Using ‘Fill Series’ can be useful when you’re starting by entering the row numbers. Unlike Fill Handle, it doesn’t require the adjacent columns to be filled already.

Even if you have nothing on the worksheet, Fill Series would still work.

Excel

Note: In case you have blank rows in the middle of the dataset, Fill Series would still fill the number for that row.

3] Using the ROW Function

You can also use Excel functions to number the rows in Excel.

In the Fill Handle and Fill Series methods above, the serial number inserted is a static value. This means that if you move the row (or cut and paste it somewhere else in the dataset), the row numbering will not change accordingly.

This shortcoming can be tackled using formulas in Excel.

You can use the ROW function to get the row numbering in Excel.

To get the row numbering using the ROW function, enter the following formula in the first cell and copy for all the other cells:

The ROW() function gives the row number of the current row. So I have subtracted 1 from it as I started from the second row onwards. If your data starts from the 5th row, you need to use the formula =ROW()-4.

The best part about using the ROW function is that it will not screw up the numberings if you delete a row in your dataset.

Since the ROW function is not referencing any cell, it will automatically (or should I say AutoMagically) adjust to give you the correct row number. Something as shown below:

Note that as soon as I delete a row, the row numbers automatically update.

Again, this would not take into account any blank records in the dataset. In case you have blank rows, it will still show the row number.

You can use the following formula to hide the row number for blank rows, but it would still not adjust the row numbers (such that the next row number is assigned to the next filled row).

4] Using the COUNTA Function

Basic Formula In Excel

If you want to number rows in a way that only the ones that are filled get a serial number, then this method is the way to go.

It uses the COUNTA function that counts the number of cells in a range that are not empty.

Suppose you have a dataset as shown below:

Note that there are blank rows in the above-shown dataset.

Here is the formula that will number the rows without numbering the blank rows.

The IF function checks whether the adjacent cell in column B is empty or not. If it’s empty, it returns a blank, but if it’s not, it returns the count of all the filled cells till that cell.

5] Using SUBTOTAL For Filtered Data

Sometimes, you may have a huge dataset, where you want to filter the data and then copy and paste the filtered data into a separate sheet.

If you use any of the methods shown above so far, you will notice that the row numbers remains the same. This means that when you copy the filtered data, you will have to update the row numbering.

In such cases, the SUBTOTAL function can automatically update the row numbers. Even when you filter the data set, the row numbers will remain intact.

Let me show you exactly how it works with an example.

Suppose you have a dataset as shown below:

If I filter this data based on Product A sales, you will get something as shown below:

Note that the serial numbers in Column A are also filtered. So now, you only see the numbers for the rows that are visible.

While this is the expected behavior, in case you want to get a serial row numbering – so that you can simply copy and paste this data somewhere else – you can use the SUBTOTAL function.

Here is the SUBTOTAL function that will make sure that even the filtered data has continuous row numbering.

The 3 in the SUBTOTAL function specifies using the COUNTA function. The second argument is the range on which COUNTA function is applied.

The benefit of the SUBTOTAL function is that it dynamically updates when you filter the data (as shown below):

Note that even when the data is filtered, the row numbering update and remains continuous.

6] Creating an Excel Table

Excel Table is a great tool that you must use when working with tabular data. It makes managing and using data a lot easier.

This is also my favorite method among all the techniques shown in this tutorial.

Serial Number Formula In Excel

Let me first show you the right way to number the rows using an Excel Table:

  • Select the entire dataset.
  • Go to the Insert Tab.
  • Click on the Table icon (you can also use the keyboard shortcut Control + T).
  • In the Create Table dialog box, make sure the range is correct.
  • Click OK. This will convert your tabular data into an Excel Table.
  • In cell A2, enter the following formula. Note that as soon as you enter the formula, it will automatically fill it in all the cells in that column (you can read more about calculated columns here).

Note that in the formula above, I have used Table2, as that is the name of my Excel table. You can replace Table2 with the name of the table you have.

There are some added benefits of using an Excel Table while numbering rows in Excel:

  1. Since Excel Table automatically inserts the formula in the entire column, it works when you insert a new row in the Table. This means that when you insert/delete rows in an Excel Table, the row numbering would automatically update (as shown below).
  2. If you add more rows to the data, Excel Table would automatically expand to include this data as a part of the table. And since the formulas automatically update in the calculated columns, it would insert the row number for the newly inserted row (as shown below).

7] Adding 1 to the Previous Row Number

This is a simple method that works.

The idea is to add 1 to the previous row number (the number in the cell above). This will make sure that subsequent rows get a number that is incremented by 1.

Suppose you have a dataset as shown below:

Here are the steps to enter row numbers using this method:

  • In the cell in the first row, enter 1 manually. In this case, it’s in cell A2.
  • In cell A3, enter the formula, =A2+1
  • Copy and paste the formula for all the cells in the column.

The above steps would enter serial numbers in all the cells in the column. In case there are any blank rows, this would still insert the row number for it.

Also note that in case you insert a new row, the row number would not update. In case you delete a row, all the cells below the deleted row would show a reference error.

These are some quick ways you can use to insert serial numbers in a tabular data in Excel.

In case you are using any other method, do share with me in the comments section.

You May Also Like the Following Excel Tutorials:

Formula
  • Delete Blank Rows in Excel (with and without VBA).
  • How to Insert Multiple Rows in Excel (4 Methods).
  • How to Split Multiple Lines in a Cell into a Separate Cells / Columns.
  • 7 Amazing Things Excel Text to Columns Can Do For You.

Session expired

Please log in again. The login page will open in a new tab. After logging in you can close it and return to this page.