Delete rows based upon duplicate Data

saribobari2002

New Member
Joined
Jan 14, 2015
Messages
11
I have a very large spreadsheet that has several rows of data that are duplicates of other rows, except for data in one cell.

For example,
A B C D E
Badge Type: Badge NameIs a Young Lawyer MemberCustomer NumberFull NameFirm Name
test 10391026 first name1last name 1
test 21118004first name 2last name 2
test 3064096first name3last name 3
test 40500461first name4last name 4
test 50500461first name 4last name 4

<colgroup><col width="152"><col width="80"><col width="71" span="3"></colgroup><tbody>
</tbody>


I would like a formula or macro that will find the match C4 & C5 and then delete the entire row C5.

There are many instances where there are between 3-6 additional rows that have this type of duplicated data.

Thank for any help or suggestions.

​​​​​​​Eric
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
give this a shot

Code:
Sub t()
Dim i As Long
    With ActiveSheet
        For i = .Cells(Rows.Count, 3).End(xlUp).Row To 2 Step -1
            If Application.CountIf(Range("C:C"), .Cells(i, 3).Value) > 1 Then
                Rows(i).Delete
            End If
        Next
    End With
End Sub

Be sure that you want to delete an entire row based on duplicates in only one column.
 
Last edited:
Upvote 0
Worked perfectly.

Thanks vm


give this a shot

Code:
Sub t()
Dim i As Long
    With ActiveSheet
        For i = .Cells(Rows.Count, 3).End(xlUp).Row To 2 Step -1
            If Application.CountIf(Range("C:C"), .Cells(i, 3).Value) > 1 Then
                Rows(i).Delete
            End If
        Next
    End With
End Sub

Be sure that you want to delete an entire row based on duplicates in only one column.
 
Upvote 0
Another way :
Code:
ActiveSheet.Range("A1:XFD" & Cells(Rows.Count, "C").End(3).Row).RemoveDuplicates Columns:=3, Header:=xlYes
 
Upvote 0

Forum statistics

Threads
1,214,913
Messages
6,122,207
Members
449,074
Latest member
cancansova

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