Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in


How to delete unique values from a column in Excel?

Usually, most of us want to remove duplicate values from a column, but sometimes, you may want to remove the unique values which appear only one time in the column. This tutorial is talking about the tricks for you to remove unique values only from a column in Excel.

Delete unqiue values with VBA in Excel

Delete unqiue values with Kutools for Excel

arrow blue right bubble Delete unqiue values with VBA in Excel

Using VBA can quickly delete all unique values from one column.

1. Press Alt + F11 to display the Microsoft Visual Basic for Applications window.

2. In the window, click Insert > Module to show a new module window, then copy the following VBA code into the module window.

VBA: Delete unique values from a column.

Sub DeleteUnique()
Dim Rng As Range
Dim WorkRng As Range
Dim Arr As Variant
Dim Dic As Variant
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set WorkRng = WorkRng.Columns(1)
Set Dic = CreateObject("Scripting.Dictionary")
Arr = WorkRng.Value
For i = 1 To UBound(Arr, 1)
    xValue = Arr(i, 1)
    Dic(xValue) = Dic(xValue) + 1
Arr = WorkRng.Value
xIndex = 1
For Each xKey In Dic.keys
    xValue = Dic(xKey)
    If xValue > 1 Then
        For i = 1 To xValue
            Arr(xIndex, 1) = xKey
            xIndex = xIndex + 1
    End If
WorkRng.Value = Arr
End Sub
3. Click Run button to run the VBA code, and a KutoolsforExcel dialog pops out for select a range to work. See screenshot:



4. Click OK, and all the unique values are deleted.

arrow blue right bubble Delete unqiue values with Kutools for Excel

If you are not familiar with VBA, you can consider to use Kutools for Excel's Select Duplicate & Unique Cells feature to remove the unique values in Excel.

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 30 days. Get it Now

1. Select the column you want to delete the unique values from, and click Kutools > Select Tools > Select Duplicate & Unique Cells. See screenshot:


2. In the pop-out dialog, check Unique values only and click Ok, and then exit this dialog. See screenshot:


3. Then all values appear only one time have been selected. And right-click to click Delete in the context menu. See screenshot:


4. In the Delete dialog, check Entire row, and click OK. See screenshot:


Now you can see the unique values are removed.

doc-delete-unique-6 doc-arrow doc-delete-unique-7

Tip: If you just want to remove the cell contents, you can click Clear Contents from the context menu in step 3.

You can click here to know more information on Select Duplicate & Unique Cells.

Relative Articles:

Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Mort W · 2 years ago
    VBA code does not work....I use option explicit and while I Dim xValue as Variant, keeps saying variable not defined.
    I'd say a good 80% of copied code from net does not work at first shot.
  • To post as a guest, your comment is unpublished.
    Mistereri · 3 years ago
    You are a life saver. God bless you
  • To post as a guest, your comment is unpublished.
    Rossini · 4 years ago
    How would one tweak the VBA code to delete the entire row based on unique value of one field only?

    The Kutools for Excel allow deletion of the entire row, but the code deletes only the unique values from one field.

    Thank you,