Delete row with duplicates but pick one to keep

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
2,104
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi

Strange one here.

I want to delete duplicates in a column, but keep the one whos date is the most up to date, for example

I have only 2 column of data. column A and column B.

1000 : 02/02/17
1001 : 02/02/17
1002 : 02/02/17
1003 : 01/02/17
1004 : 01/02/17
1002 : 01/02/17

so as you can see, i have in column A a duplicate, 1002, one has a date of 02/02/17 and one has a date of 01/02/17.
so i would like to end up with the oldest date removed. like

1000 : 02/02/17
1001 : 02/02/17
1002 : 02/02/17
1003 : 01/02/17
1004 : 01/02/17

at the most my column will be 100 rows long and have a max number of duplicates of 5.

But i really dont know how to go about achieving this.

Thanks for looking

Dave
 
Last edited:
Where did you paste the code ??
Try changing the name of the macro from MM1 to filtem, or any other name
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
hi michael

I put the code in a standard module.

And yes, changing the sub name from MM1 worked mate.

Tested the code once and it would appear to be working perfectly.
So i cannot thank you enough for this, i was really insure how to do this myself in code.

Any idea why MM1 was causing a problem, im sure ive seen you post code with that sub name before??

Many thanks again.

JLGWhiz and Ford, many thanks for your input also.

regards

Dave
 
Upvote 0
I ALWAYS use that Sub name, but for some reason, and maybe the others might know, every now and then it won't accept MM1 as a sub name, because it thinks it is a cell reference...glad you got it sorted though...(y)
 
Upvote 0

Forum statistics

Threads
1,215,359
Messages
6,124,488
Members
449,166
Latest member
hokjock

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