Macro to delete Duplicate Records

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,601
Office Version
  1. 2021
Platform
  1. Windows
I have a spreadsheet containing numerous duplicate references. These aere contained in Col H. I would like a macro that will delere only one of the duplicate records. For EG if H25, contains Ref 145609 & H26 contains 145609, then the first row containing the duplicate record must be deleted

Your assistance will be most appreciated
 
Hi Howard,

I see that the reply I tried to send you a few hours ago didn't go through...

So replace this part of your formula:

H93="F?"

with this:

LEFT(H93,1)="F"

Excel will check the 1st (hence the "1") character starting from the left of what is displayed in the H93 cell to see if it is equal to the letter "F".

Btw, I didn't invent this solution, I found it while searching the web for more ways to use the "COUNT" function.

Regards,

W.
 
Last edited:
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi again Howard,

I didn't read your request correctly...

In fact you need something like:

=IF(AND(COUNTIF(H:H,H3)>1,LEFT(H3,1)="F"),"1/1",COUNTIF(H$3:H3,H3)&"/"&COUNTIF(H:H,H3))

The "AND" part makes sure that both conditions (duplicate (more than 1 occurence) and begining with "F") are met, if it's the case, "1/1" is displayed, otherwise the COUNTIF formula is applied.

Regards,

W.
 
Upvote 0
Thanks for the help, the macro works perfectly. I would like you to amend your code, to exclude text, where the text starts with an Alpha character for Eg F1480

Your assistance will be most appreciated
 
Upvote 0
Hi Walky

Thanks for the help, formula works perfectly.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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