Delete duplicates with macro keeping only the newest by date

tmpollard

Board Regular
Joined
Jun 12, 2008
Messages
111
Hello,
Can I please get some help with a macro, I put the columns and rows in to better define what I'm looking for. The keys for me are column B and column D.

Row 2 and row 3 have the same unit number whenever this is identified look at column D and only keep the row with the most current time. In this example row 3 would be kept and row 2 deleted from the spreadsheet.

My spreadsheet will have up to 100000 rows of data. Thank you all.

Column AColumn BColumn cColumn DColumn EColumn F
Row 1Green JacketCreated OnCreated AtProductGrams Weight
Row 2Unit 15/1/201517:00:40A71.907
Row 3Unit 15/1/201517:23:56A264.216
Row 4Unit 25/1/201517:02:48A71.907
Row 5Unit 25/1/201517:24:04A264.216
Row 6Unit 35/1/201517:03:02A71.907
Row 7Unit 35/1/201517:24:12A264.216
Row 8Unit 45/1/201517:03:17A71.907
Row 9Unit 45/1/201517:24:23A264.216
Row 10Unit 55/1/201517:03:30A126.255
Row 11Unit 55/1/201517:24:35A464.887
Row 12Unit 65/1/201517:03:44A71.907
Row 13Unit 65/1/201517:24:47A264.216
Row 14Unit 75/1/201517:03:56A71.907
Row 15Unit 75/1/201517:24:58A264.216
Row 16Unit 85/1/201517:04:14A71.907
Row 17Unit 85/1/201517:25:10A264.216

<tbody>
</tbody>

 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Are there ever going to be more that two instances of the same Unit name in Column B? And is Column B always going to be sorted by name?
 
Upvote 0
In the data sets that i've viewed there has always only been two but it is possible that it could be more.
 
Upvote 0

Forum statistics

Threads
1,203,111
Messages
6,053,569
Members
444,673
Latest member
Jagadeshrao

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