Add Sequential Numbers to Specific Range

XcelTr

New Member
Joined
Jul 23, 2012
Messages
4
Hi everyone,

I have a sheet of more than 1000 rows and I want to insert sequential numbers for specific range in one column. As I have large data, I need to do it automatically with the help of formula or macros.

The problem is that the range in column (ex. A) is not constant and will be changed on each name.
The scenario would be like this:
Col.A Col.B Col.C
1 First Name Position
1 First Name Position
1 First Name Position
1 First Name Position
1 First Name Position
2 Sec.Name Position
2 Sec.Name Position
2 Sec.Name Position
3 Third.Name Position
3 Third.Name Position
3 Third.Name Position

I hope I could explain my problem and appreciate any kind of help for that.

Thanks
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Assuming your data start on Row 1, put a 1 in cell A1, then put the following formula in A2 and copy it down to the end of your data...

=IF(A2=A1,B1,B1+1)
 
Upvote 0
Thanks, but i dont wanna to return the value of column B. Let me explain more:

The value of Column A is: serial numbers
The value of Column B is different depend on name

1 Patrick July12 Salary
1 Patrick July12 Med
1 Patrick July12 Sal Ded.
1 Patrick Payment

2 John July12 Sal
2 John July12 Med
2 John July 12 Payment

3
.
.
.
and so on with different rows for each person. I have manually correct it, but the problem comes when i delete one of these names in the middle of sheet and then numbers will be changed up to end.



Assuming your data start on Row 1, put a 1 in cell A1, then put the following formula in A2 and copy it down to the end of your data...

=IF(A2=A1,B1,B1+1)
 
Upvote 0
Thanks, but i dont wanna to return the value of column B. Let me explain more:

The value of Column A is: serial numbers
The value of Column B is different depend on name

1 Patrick July12 Salary
1 Patrick July12 Med
1 Patrick July12 Sal Ded.
1 Patrick Payment

2 John July12 Sal
2 John July12 Med
2 John July 12 Payment

3
.
.
.
and so on with different rows for each person. I have manually correct it, but the problem comes when i delete one of these names in the middle of sheet and then numbers will be changed up to end.

Sorry, I had the references backwards, this is the formula I should have posted...

=IF(B2=B1,A1,A1+1)

However, if those blanks you are now showing between different names are really there (you did not show them in your original message), then this formula would not work.
 
Upvote 0
Thanks, it worked very well. I used an identical number instead of the name and worked.

Thanks for saving my time.

Best,
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top