For example I have the Table below
Name | Product |
---|---|
Tom | Ice Cream |
Tom | Ice Cream |
Tom | Toys |
Jack | Ice Cream |
I'm trying to remove duplicate products associated with a certain name, so I would need to remove the extra Tom and Ice Cream row, but ensure that the Jack and Ice Cream row is kept.
I also have the following code I used in VBA to try to loop the filter in order to remove the duplicates, but it doesn't seem to work as I can't only select the sorted range when using Remove Duplicates
Sub Delete_Duplicates()
Dim Cell As Range
Worksheetname.Range("A1:B1").Select
Selection.AutoFilter
For Each Cell In Worksheetname("E1").End(xlDown)
ActiveSheet.Range("$A$1:$B$8570").AutoFilter Field:=1, Criteria1:=Cell
ActiveSheet.Range("$A$1", Range("B2").End(xlDown)).RemoveDuplicates Columns:=2, Header:=xlYes
Next Cell
End Sub
Any other methods using VBA or just Excel are much welcomed