SOLVED

Removing all values that appears more than once Leave ONLY one Unique

Copper Contributor

Hello Team,

How can I remove just a single cell duplicate without affecting whole rows for duplicate value? I have more than 160,000 rows, with a lot of those duplicates. Below is an example of what I need. I have also attached an excel file, I am using 365.

TuM_29_0-1620552129091.png

 

TuM_29_1-1620552203437.png

 

2 Replies
best response confirmed by TuM_29 (Copper Contributor)
Solution

@TuM_29 

Here is a macro that you can run:

Sub ClearDuplicates()
    Dim r As Long
    Dim m As Long
    Dim v As Variant
    Application.ScreenUpdating = False
    m = Range("A:B").Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    v = Range("A1:B" & m).Value
    For r = m To 3 Step -1
        If v(r, 1) = v(r - 1, 1) Then
            v(r, 1) = ""
            v(r, 2) = ""
        End If
    Next r
    Range("A1:B" & m).Value = v
    Application.ScreenUpdating = True
End Sub

@Hans Vogelaar 

Thank you so much, this is helpful ..... Now I need to be familiar with Macro for sure :folded_hands::folded_hands:

1 best response

Accepted Solutions
best response confirmed by TuM_29 (Copper Contributor)
Solution

@TuM_29 

Here is a macro that you can run:

Sub ClearDuplicates()
    Dim r As Long
    Dim m As Long
    Dim v As Variant
    Application.ScreenUpdating = False
    m = Range("A:B").Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    v = Range("A1:B" & m).Value
    For r = m To 3 Step -1
        If v(r, 1) = v(r - 1, 1) Then
            v(r, 1) = ""
            v(r, 2) = ""
        End If
    Next r
    Range("A1:B" & m).Value = v
    Application.ScreenUpdating = True
End Sub

View solution in original post