MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Sequence Counting

Posted by ismael on July 06, 2001 3:51 PM


I guess my problem will be basic for most of you but here it is. I am trying to count the sequence of appearance as shown below.

customer ID | sequence
0001 | 1
0001 | 2
0001 | 3
0001 | 4
0002 | 1
0002 | 2
0003 | 1
0003 | 2
0003 | 3

As you can see i want to count the sequence number (1,2,3,4 etc) for each customer id. I dont know how to do it. If any of you can help, I would greatly appreciate.


Posted by Scott S on July 06, 2001 7:23 PM

I'm not sure if I understand this correctly but I'll try. If your sample data is in A2:B10, You can list your Customer IDs in D2:D4 (1,2,3). Then in Cell E2, type in the following formula:


This will count how many times each customer shows up on your list. You can copy this formula down through E4 (or however long your customer list is).

Posted by Mark W. on July 09, 2001 2:58 PM

With your 'customer ID' in cells A1:A9, enter the
formula, =COUNTIF($A$1:A1,A1), into cell B1 and
Copy down to cell B9.