Showing only unique values

danielrussell2

New Member
Joined
Mar 17, 2016
Messages
17
I have a column of names that I put together from two different lists. The list will mostly be duplicates, as they are similar sets of names from different sources. However, there will be some names that were included on one and not the other, or there may be different spelling/versions of the names (I've tried to include a decent sample of what I mean below).

Ben Amos
Benjamin Amos
Kenny Brothers
Larry Chisenhall
Larry Chisenhall
Charlie Chisenhall
Charlie Chisenhall
Derrick Lawrie
Derrick Lowrie
Ken Stiles
Kenneth Stiles
Walter Young
Walter Young

I would want the above list to remove all of the same duplicates (not just one of them as with the "remove duplicates" task with Data Tools) and leave any names that are unique, which from the above list, would give me:

Ben Amos
Benjamin Amos
Kenny Brothers
Derrick Lawrie
Derrick Lowrie
Ken Stiles
Kenneth Stiles

Any ideas on how to do this? Thanks!!!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Will something like this work for you?
Code:
Range("A1:A10").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("B1"), unique:=True
 
Upvote 0
Click on Data/Filter/Advanced Filter then select unique records only.
 
Last edited:
Upvote 0
maybe something like....

c2=IFERROR(INDEX($A$2:$A$14,SMALL(IF(COUNTIF($A$2:$A$14,$A$2:$A$14)=1,ROW($A$2:$A$14)-ROW($A$2)+1),ROWS($C$2:C2))),"") Control Shift Enter


Row\Col
A​
B​
C​
2​
Ben AmosBen Amos
3​
Benjamin AmosBenjamin Amos
4​
Kenny BrothersKenny Brothers
5​
Larry ChisenhallDerrick Lawrie
6​
Larry ChisenhallDerrick Lowrie
7​
Charlie ChisenhallKen Stiles
8​
Charlie ChisenhallKenneth Stiles
9​
Derrick Lawrie
10​
Derrick Lowrie
11​
Ken Stiles
12​
Kenneth Stiles
13​
Walter Young
14​
Walter Young

<tbody>
</tbody>
 
Upvote 0
maybe something like....

c2=IFERROR(INDEX($A$2:$A$14,SMALL(IF(COUNTIF($A$2:$A$14,$A$2:$A$14)=1,ROW($A$2:$A$14)-ROW($A$2)+1),ROWS($C$2:C2))),"") Control Shift Enter


Row\Col
A​
B​
C​
2​
Ben AmosBen Amos
3​
Benjamin AmosBenjamin Amos
4​
Kenny BrothersKenny Brothers
5​
Larry ChisenhallDerrick Lawrie
6​
Larry ChisenhallDerrick Lowrie
7​
Charlie ChisenhallKen Stiles
8​
Charlie ChisenhallKenneth Stiles
9​
Derrick Lawrie
10​
Derrick Lowrie
11​
Ken Stiles
12​
Kenneth Stiles
13​
Walter Young
14​
Walter Young

<tbody>
</tbody>

I must have messed something up when I changed the parameters of the table I'm trying to widdle down - goes from A1 to A2560, and I'm trying to put the new table starting in C1

=IFERROR(INDEX($A$1:$A$2560,SMALL(IF(COUNTIF($A$1:$A$2560,$A$1:$A$2560)=1,ROW($A$1:$A$2560)-ROW($A$1)+1),ROWS($C$1:C1))),"")
 
Upvote 0
are you sure you commited the formula with control shift enter, not just enter ?
 
Upvote 0
danielrussell2,

If I understand you correctly, then here is a macro solution for you to consider.

Sample raw data, and, results:


Excel 2007
ABC
1Ben AmosBen Amos
2Benjamin AmosBenjamin Amos
3Kenny BrothersKenny Brothers
4Larry ChisenhallLarry Chisenhall
5Larry ChisenhallCharlie Chisenhall
6Charlie ChisenhallDerrick Lawrie
7Charlie ChisenhallKen Stiles
8Derrick LawrieKenneth Stiles
9Derrick LawrieWalter Young
10Ken Stiles
11Kenneth Stiles
12Walter Young
13Walter Young
14
Sheet1


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

Code:
Sub GetUniqueNames()
' hiker95, 03/18/2016, ME928938
Dim r As Range, rng As Range
Application.ScreenUpdating = False
Set rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
With CreateObject("Scripting.Dictionary")
  .CompareMode = vbTextCompare
  For Each r In rng
    If Not .Exists(r.Value) Then
      .Add r.Value, r.Value
    End If
  Next
  Range("C1").Resize(.Count) = Application.Transpose(Array(.Keys))
  Columns(3).AutoFit
End With
Application.ScreenUpdating = True
End Sub


How To Install Macros:

If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name ( GetUniqueNames ) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Last edited:
Upvote 0
Hi danielrussel2,
Can you use something like this?
Mike Szczesny


Excel 2012
ABCD
1Ben AmosBen Amos
2Benjamin AmosBenjamin Amos
3Kenny BrothersKenny Brothers
4Larry ChisenhallDerrick Lawrie
5Larry ChisenhallDerrick Lowrie
6Charlie ChisenhallKen Stiles
7Charlie ChisenhallKenneth Stiles
8Derrick Lawrie
9Derrick Lowrie
10Ken Stiles
11Kenneth Stiles
12Walter Young
13Walter Young
Sheet1
Cell Formulas
RangeFormula
C1{=IFERROR(INDEX($A$1:$A$13,SMALL(IF(FREQUENCY(IF($A$1:$A$13<>"",MATCH($A$1:$A$13,$A$1:$A$13,0)),ROW($A$1:$A$13)-ROW($A$1)+1)=1,ROW($A$1:$A$13)-ROW($B$1)+1),ROWS($C$1:C1))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,402
Messages
6,119,299
Members
448,885
Latest member
LokiSonic

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