Delete Duplicates

dlatha01

Board Regular
Joined
Apr 7, 2009
Messages
65
Hi guys

Is there a way to delete duplicates from a spreadsheets, via macros or other routes?

Cheers

David
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Colin Legg

MrExcel MVP, Like totally RAD man
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi David,

Which version of Excel are you using?
 

Stormseed

Banned
Joined
Sep 18, 2006
Messages
3,274
If you do a search on this board or even google it, you will find thousands of links which would answer your question.

Edit: you can either use VBA or use an advanced filter to delete duplicates, depends on the layout of your data and your requirement.
 

Colin Legg

MrExcel MVP, Like totally RAD man
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Last edited:
L

Legacy 14611

Guest
Try this macro and see if it's what you want. If you want the duplicates just cleared rather than actively deleted put apostrophes before the 2nd to last and 3rd to last lines
Code:
Sub deletedups()
Dim e
With CreateObject("Scripting.Dictionary")
For Each e In ActiveSheet.UsedRange
    If Not .exists(e.Value) Then
        .Add e.Value, Empty
    Else: e.Value = Empty
    End If
Next
End With
Application.ScreenUpdating = 0
ActiveSheet.UsedRange.SpecialCells(4).Delete xlUp
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,496
Messages
5,596,502
Members
414,073
Latest member
Contilly

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
Top