create consecutive numbers on change of number

weissihm

New Member
Joined
May 21, 2015
Messages
8
I am looking for a formula or macro that can number consecutively until a number changes, then restart.
Below is sample data that I have. In column A I have customer numbers, in column B I would like a way to number them consecutively until the value in column A changes.

Column A

371663

B

1
3716632
3716633
3716634
3716635
3716636
3716637
3720031
3720032
3726461
3726462
3754861
3754862
3770611
3770612
3789901
3789902

<colgroup><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Welcome to the board.

Row\Col
A​
B​
C​
1​
Col A
Col B
2​
371663​
1​
B2: =IF(A2=A1, B1) + 1
3​
371663​
2​
4​
371663​
3​
5​
371663​
4​
6​
371663​
5​
7​
371663​
6​
8​
371663​
7​
9​
372003​
1​
10​
372003​
2​
 
Upvote 0
Another option:

=COUNTIF($A$1:A1,A1)

Of course, this makes the assumption that numbers are sorted and not repeated further down the list.
 
Upvote 0

Forum statistics

Threads
1,203,728
Messages
6,057,005
Members
444,902
Latest member
ExerciseInFutility

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