Create a number sequence for each change in a column in excel [Quick Tip]

Posted on June 29th, 2009 in Excel Howtos , Learn Excel - 4 comments

Create sequence numbers based on change in a column valuesHere is a quick formula trick you can use to generate sequence numbers that only increment when there is a change.

Assuming the sequence of values are in column C from C3,

  • you can write the following formula in B4 onwards (B3 will be 1, wake up…)
    =IF(C4=C3,B3,B3+1)
  • Now just copy paste the formula over the entire range B2:Bxxx to generate sequence numbers.

How it works?

  • That is for your home work for the day :P

Browse more excel quick tips and learn something cool.

Subscribe to Chandoo.org Email updates and get a free excel e-book with 95 tips & tricks

Comments
Peter H June 29, 2009

I have used a similar technique using conditional formatting to identify when lists change. Our Production Scheduling Program gives a readout like this:-
Dept M/c Tool Job No
A A1 T1 J1
A A1 T1 J2
A A1 T2 J3
A A2 T2 J4
A A2 T3 J5
A A2 T3 J6
A A2 T4 J7
A A2 T5 J8
A A2 T6 J9
B B1 T7 J10
B B1 T7 J11
B B1 T7 J12
B B1 T8 J13
B B2 T9 J14
B B2 T10 J15
B B2 T10 J16
B B2 T10 J17
B B2 T10 J18

If you add 2 conditional formats to each cell:-
=A2=A1 – font colour equals white &
=A2A1 – add a line to the top of the cell it comes out like this:-

Dept M/c Tool Job No
A A1 T1 J1
J2
T2 J3
J4
A2 T3 J5
J6
T4 J7
T5 J8
T6 J9
B B1 T7 J10
J11
J12
T8 J13
B2 T9 J14
T10 J15
J16
J17
J18
With the proper spread sheet with the horizontal lines drawn this is much easier to read

Peter H June 29, 2009

Hi Chandoo

Sorry about the formatting of the above post.
I am new at this commenting game & dont know how to make the formatting come out correct

@Peter H: Welcome to PHD and commenting. :) I like your idea. When I get sometime I will create a screenshot of this and post it here so that other readers will know how it would look.

Also, you dont need 2 conditional formats. You can set the cell font color to white for all in one stroke and then use conditional formatting to turn the color to black when a2 not equal to a1.

ronnie lack February 15, 2010

dilbert hello, my name is roni have 62 anos.vamos interesa what I’m learning to move in excel, as do combinations of 1.2.3 up to 25, using 15 numbers

RSS feed for comments on this post. TrackBack URI

Leave a comment

   Name (required)

   E-mail (required, never displayed)

   URL