Identify first instance of duplicate entries, number them and loop until the end

Jockster

Board Regular
Joined
Jan 16, 2009
Messages
88
A simple table has four columns: ID number, Name, Year, Time.
Over the years (since 1960), more and more data has been added with each new name receiving the next available ID number. Some names are unique, others have been entered multiple times.
Once the table is sorted by year then by time, I would like to identify the first entry for each ID and allocate it a number (column E) to show the order in which people first did the challenge regardless of how many times they have actually done it.
By doing this, I would be able to tell who was the 50th person or the 100th person to do so and ultimately, how many unique names have completed the challenge.

I am unsure of how to even start looking at this but I do have a separate list of ID numbers (in column M but not in the table).
Starting at the first entry in this list, VBA would search down column A until if found the first match then add "1" to a new column (E).
The second number would be searched for and "2" placed in column 'E' and so on until the end of the list of unique IDs.

All help appreciated!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
VBA is certainly an option is that's what you want, but keep in mind you can do this with a formula too:

Book1
ABCDE
1IDNameYearTimeFirst Time?
2100200111
3101200222
410020033 
5102200443
610020055 
7103200564
810020057 
910220058 
10105200695
11102200710 
12102200811 
13102200912 
Sheet2
Cell Formulas
RangeFormula
E2:E13E2=IF(COUNTIF($A$1:$A1,A2)=0,MAX($E$1:$E1)+1,"")


Let us know if this suffices, or if you still want a macro.
 
Upvote 0

Forum statistics

Threads
1,214,936
Messages
6,122,340
Members
449,079
Latest member
rocketslinger

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