Loading

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.

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.

Learn more about Allen...

ExcelTips FAQ

ExcelTips Resources

Ask an Excel Question

Make a Comment

Free Business Forms

Free Calendars

** 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),

Libby wants to insert a row number into column A of her worksheet. She wants the column to reflect the correct number of the row, even when she adds or deletes rows.

There are any number of formulas you can use in column A that will return a row number. Perhaps the easiest is to use the ROW function, like this:

=ROW()

This formula returns the row number of the cell in which the formula appears. If you want to offset the row number returned (for instance, if you have some headers in rows 1 and 2 and you want cell A3 to return a row value of 1), then you can modify the formula to reflect the desired adjustment:

=ROW()-2

Of course, the ROW function isn't the only candidate for your formulas. You can also use a formula that actually examines the contents of the adjacent column (B) and return a row number only if there is something in that adjacent cell.

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

This formula, placed in cell A1, examines the contents of cell B1. If there is something there, then the COUNTA function is used to count the number of occupied cells between cell B1 and whatever cell is to the right of where this formula is placed. The formula also places a period after the row number that is returned. Make sure the dollar signs are included, as shown, and then copy the formula down as many cells as necessary to create your row numbers.

The advantage to a formula such as this one is that it checks to see if something is in column B before it returns a row number. This means that you can copy the formula down beyond the actual end of your data rows, and only those rows that have data (triggered by something in column B) will have a row number. The same sort of technique could be used with the ROW function instead of the COUNTA function:

=IF(TRIM(B1)<>"",ROW()&".","")

*ExcelTips* is your source for cost-effective Microsoft Excel training. This tip (2911) 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: Automatically Numbering Rows.

*Related Tips:*

**Create Custom Apps with VBA!** Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out *Mastering VBA for Office 2013* today!

=IF(TRIM(B1)<>"",ROW()&".","")

The above formula works well, but if an existing row is deleted, or a new row is inserted, the numbers could change.

That could be prevented however, by creating a data entry form and using VBA to paste the new data into the first empty row of a protected worksheet.

The above formula works well, but if an existing row is deleted, or a new row is inserted, the numbers could change.

That could be prevented however, by creating a data entry form and using VBA to paste the new data into the first empty row of a protected worksheet.

I have to the given numbering to the rows which more than but i don't have time to drag the mouse . please tell me any formula

I write in the coloum in a cell sravan

I want to be a coloum in b surya how ca n get automatic name please ams me

I want to be a coloum in b surya how ca n get automatic name please ams me

Thank you. It was really helpful.

@Albert A.,

* In cell A1 type: 17

* In cell A2 type: 1

* In cell A3 type the following formula and copy it down:

=IF(A2+1<=A$1,A2+1,"")

*** try to change the value in cell A1

--------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

* In cell A1 type: 17

* In cell A2 type: 1

* In cell A3 type the following formula and copy it down:

=IF(A2+1<=A$1,A2+1,"")

*** try to change the value in cell A1

--------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

Your help will be appreciated.

I think the answer to my question may be in this tip... If in A1 I type the any number, but for this exmaple I will use the number "17". I want to see the numbers 1 thru 17 displayed starting in A2-A19. If the number on A1 is updated to "33", then display 1 thru 33 from A2-A34.

I think the answer to my question may be in this tip... If in A1 I type the any number, but for this exmaple I will use the number "17". I want to see the numbers 1 thru 17 displayed starting in A2-A19. If the number on A1 is updated to "33", then display 1 thru 33 from A2-A34.

Hi! thanks for this tip but i have a problem about my worksheet for school, I used this formula - (on the 1st column A1) =IF(B1="","",1), (On the 2nd column,A2) =IF(B2="","",A1+1), drag it down and it works fine but when i put a formula on cell B1 which has a reference to another worksheet (student's name),and also drag it down, the numbers become visible even when cell B1 up to the bottom is blank but has a formula. How can i make the numbers in column A invisible when there is no visible characters or text in the next cell (column B with a formula)? Please help. Thank You in advance.

@Niki,

I was able to understand only the first part of your request.

In cell A1 type: =(ROW()+4)*10 and copy down as far as needed.

--------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

I was able to understand only the first part of your request.

In cell A1 type: =(ROW()+4)*10 and copy down as far as needed.

--------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

Updates.

how to change value automatically after 10 rows like

A1 50

A2 60

i want in next sheet#2

A1 to A 10 same value like 50

than automatically A10 to A20 value will be 60??

A1 50

A2 60

i want in next sheet#2

A1 to A 10 same value like 50

than automatically A10 to A20 value will be 60??

Hello Excel power users,

I'm trying to use a formula to number rows throughout my excel worksheet. I have a general ledger in excel and only want to assign numbering to debits or credits. For example: my first row may contain an account number or there maybe no date in the row at all. I want to be able to number every row in the worksheet and then go through and manually delete the numbers for data in rows I do not want to include. Once I delete the number, I want all the sequential numbering to update itself.

I'm trying to use a formula to number rows throughout my excel worksheet. I have a general ledger in excel and only want to assign numbering to debits or credits. For example: my first row may contain an account number or there maybe no date in the row at all. I want to be able to number every row in the worksheet and then go through and manually delete the numbers for data in rows I do not want to include. Once I delete the number, I want all the sequential numbering to update itself.

super this formula very helpful to me

how can i serial my number from excel sheet..

@lipsa,

In cell A1 type the following formula and copy down as far as needed.

="UAE.PEG."&ROW()&".06.2016"

---------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

In cell A1 type the following formula and copy down as far as needed.

="UAE.PEG."&ROW()&".06.2016"

---------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

@adonis abocatal jr.,

NOT up to cell A50.

Copy it right to cell AA1

---------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

NOT up to cell A50.

Copy it right to cell AA1

---------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

@adonis abocatal jr.,

I'm not sure I fully understood your request but in the mean while try this - in cell C1 type the hereunder suggested formula and copy along row 1 up to cell A50.

=IF(COLUMN()-3+$A1>$B1,"", COLUMN()-3+$A1)

---------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

I'm not sure I fully understood your request but in the mean while try this - in cell C1 type the hereunder suggested formula and copy along row 1 up to cell A50.

=IF(COLUMN()-3+$A1>$B1,"", COLUMN()-3+$A1)

---------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

@Sibin,

In cell A1 type: =INT((ROW()-1)/10)+1 and copy down as far as needed.

---------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

In cell A1 type: =INT((ROW()-1)/10)+1 and copy down as far as needed.

---------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

i want below ouput:

UAE.PEG.1.06.2016

UAE.PEG.2.06.2016

UAE.PEG.3.06.2016

.

.

.

UAE.PEG.100.06.2016

please help me by using formula

UAE.PEG.1.06.2016

UAE.PEG.2.06.2016

UAE.PEG.3.06.2016

.

.

.

UAE.PEG.100.06.2016

please help me by using formula

Hello,

I wish to enter more than 100 numbers in a column, but when I change any number in between,the following number does not change.

I wish to enter more than 100 numbers in a column, but when I change any number in between,the following number does not change.

please help me if how can i generate serial no.

in cell A value is 1

in cell B value is 5

i want to generate serial number

in cell C=1 D=2 E=3 F=4 G=5

in cell A value is 1

in cell B value is 5

i want to generate serial number

in cell C=1 D=2 E=3 F=4 G=5

hi i need a formula for below ex:

A B C D E F G H I J & SO ON...

FROM TO QTY

1 10 10 1 2 3 4 5 6 7 8 9 10

11 15 4 11 12 13 14 15

value in A B if i enter qty in cell c

will generate serial no. to D & So on..

A B C D E F G H I J & SO ON...

FROM TO QTY

1 10 10 1 2 3 4 5 6 7 8 9 10

11 15 4 11 12 13 14 15

value in A B if i enter qty in cell c

will generate serial no. to D & So on..

Hi,

Is there any formula available for generating numbers where for ten cells the number should be constant.

Eg.

cell number I need

1 1

2 1

3 1

4 1

5 1

6 1

7 1

8 1

9 1

10 1

11 2

12 2

13 2

14 2

15 2

16 2

17 2

18 2

19 2

20 2

21 3

22 3

Is there any formula available for generating numbers where for ten cells the number should be constant.

Eg.

cell number I need

1 1

2 1

3 1

4 1

5 1

6 1

7 1

8 1

9 1

10 1

11 2

12 2

13 2

14 2

15 2

16 2

17 2

18 2

19 2

20 2

21 3

22 3

@Pete,

In cell A1 type a "legal" date.

In cell A2 type: =EDATE(A1,1)

Now, copy cell A2 down up to A24.

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2015)

ISRAEL

In cell A1 type a "legal" date.

In cell A2 type: =EDATE(A1,1)

Now, copy cell A2 down up to A24.

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2015)

ISRAEL

How do I create a column containing dates starting with 20150305 or March 05 2015 and continuing for say 2 years, with a dated row created on the 5th of each month.

YES! FINALLY THANK YOU! THIS IS EXACTLY WHAT I WAS LOOKING FOR BUT FOR SOME REASON WAS REALLY HARD TO FIND!!!!

Thank you for telling me how to print my row numbers. It was fast and easy! Thank you very mch. I used =row()-1 in Cell A2 and it works.

Thank you very much.

Carol

Thank you very much.

Carol

@Willy,

"Be careful".

What will happen when she will run the Find & Replace over a column which has:

614614 and 615614 ?

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2015)

ISRAEL

"Be careful".

What will happen when she will run the Find & Replace over a column which has:

614614 and 615614 ?

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2015)

ISRAEL

@Amber

Another way is to use Find and Replace.

- Select the cells you want to change

- Press Ctrl+H

- enter 614 in de 'Find What:'

- enter 615 in 'Replace with:'

- click Replace All

Another way is to use Find and Replace.

- Select the cells you want to change

- Press Ctrl+H

- enter 614 in de 'Find What:'

- enter 615 in 'Replace with:'

- click Replace All

@Amber

The fastest way - without any helper column and/or VBA Programming will be:

* in cell A3 change (type) the new number: 615000

* In A4 type: 615001

* Select both(!) cells > click & hold(!) the lower right corner of cell A4 (the fill handle) and drag down until the last cell you want to fill the sequential numbers and release the mouse.

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2015)

ISRAEL

The fastest way - without any helper column and/or VBA Programming will be:

* in cell A3 change (type) the new number: 615000

* In A4 type: 615001

* Select both(!) cells > click & hold(!) the lower right corner of cell A4 (the fill handle) and drag down until the last cell you want to fill the sequential numbers and release the mouse.

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2015)

ISRAEL

In column A cell #3 I have a number of 614000 then #4 is 614001 #5 is 614002 and so on and so on. I want to change the 3rd number which is the 4 in 614000 to a 5 all the way down. How do I do this?

Thanks for posting this solution - it was just what I needed!

The trouble with this formula

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

is that, while it will not number rows that have only a space in the b cell, it will count them.

Thus your numbering may not be consecutive.

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

is that, while it will not number rows that have only a space in the b cell, it will count them.

Thus your numbering may not be consecutive.