Remove Duplicate based on Time

cothraw1

New Member
Joined
Jan 11, 2008
Messages
11
I have a spreadsheet with 3 columns: Usercode, Date Accessed and Time Accessed. The major sort is Usercode and then a minor sort by Date Accessed and then Time Accessed. I need a macro that will remove all of the duplicate Date Accessed for each unique Usercode and the remaining Date Accessed should be the one with the earliest Time Accessed for that particular day. It would do this for each unique Usercode so each Usercode may have the same values for Date Accessed but for each unique Usercode there would only be unique values for Date Accessed which would be the one with the earliest Time Accessed for that particular day . For instance, in my example below, I would need the macro to remove Rows A, D, F, H and I. If it helps, the original format for Date Accessed is 1/8/2018 9:47:33 AM in one cell but then I just used a formula to split the two to read 1/8/2018 and 9:47 AM into two separate cells. Any help would be much appreciated.

Row Usercode Date Accessed Time Accessed
A AB 1/8/2018 9:47 AM
B AB 1/8/2018 9:21 AM
C AB 1/4/2018 11:05 AM
D AB 1/3/2018 11:14 AM
E AB 1/3/2018 11:00 AM
F CD 1/8/2018 1:33 PM
G CD 1/8/2018 9:11 AM
H CD 1/5/2018 4:16 PM
I CD 1/5/2018 2:03 PM
J CD 1/5/2018 9:04 AM
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,223,910
Messages
6,175,320
Members
452,635
Latest member
laura12345

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