elimating unique values in a column

jrwilmott

New Member
Joined
Feb 25, 2005
Messages
20
There are many ways of elimating duplicate values (all integers) in excel. But how do you elimate unique values in a list?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi,

I've found several solutions to this before by doing a search on this forum. There are posts on macro's that can do this.

Most often than not I create a countif that counts down the column the number of occurences of items. See below: I then filter the duplicates and delete the lines.
Book2
BCDE
1ListCheck
2jonok
3jonduplicate
4daveok
5daveduplicate
6samok
7samduplicate
8jonduplicate
9andyok
10andyduplicate
11stewartok
12daveduplicate
13stewartduplicate
Sheet1
 
Upvote 0
I find Advanced Filter to be the best way to get rid of duplicates.

Use the following settings:

Action - Copy to another location
List range - the data to be de-duplicated
Criteria range - leave blank
Copy to - where you want the filtered data to appear (has to be on the same sheet)
Unique records only - Yes (ticked)

Dom
 
Upvote 0
jrwilmott said:
There are many ways of elimating duplicate values (all integers) in excel. But how do you elimate unique values in a list?

Do you mean to get from:

bob
bob
carla
dennis
bob
carla

the list:

bob
carla
 
Upvote 0
Here's one way:

Code:
Sub DupTime()
Dim cn As Object, rs As Object
Dim clcMde As Long

With Application
    clcMde = .Calculation
    .ScreenUpdating = False: .Calculation = xlCalculationManual
End With

With Sheets(1)
    .Rows("1:1").Insert
    .Range("A1").Value = "col1"
End With

Set cn = CreateObject("ADODB.Connection")

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
    ThisWorkbook.FullName & ";Extended Properties=Excel 8.0;"

Set rs = CreateObject("ADODB.Recordset")

With rs
    .Open "Select col1 From [Sheet1$a:a] group by col1 having Count(col1)>1", cn, 3, 3
    Sheets(1).[b2].CopyFromRecordset rs
    .Close
End With

cn.Close
Set rs = Nothing: Set cn = Nothing

Sheets(1).Rows("1:1").Delete

With Application
    .Calculation = clcMde: .ScreenUpdating = True
End With

End Sub
Your workbook would need to be saved prior to running this.
 
Upvote 0

Forum statistics

Threads
1,215,313
Messages
6,124,201
Members
449,147
Latest member
sweetkt327

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