I have a large list of OEM numbers that have duplicates and I cannot get the "Remove Duplicates" in Excel to work. How do I do this? [ATTACH]n1222753[/ATTACH]
Remove Duplicates wont work
-
-
Hello,
Looks like your OEM id field ... is very specific ...
Have you tried to insert a Pivot Table ? ... see attached ...
Hope this will help
-
I don't understand what to do with this pivot table. It seems to show me that there are duplicates which I already know. I am only removing the OEM duplicates.
-
Well ... if there are duplicates in the Pivot table ... it does mean your original data might probably need some cleaning to get rid for example of blanks, spaces, etc ...
Are you getting this list from a mainframe download ...?
-
Re,
Based on your test file ...
6'337 records
5'523 OEMs appear once
634 OEMs appear twice
168 OEMs appear three times
12 OEMS appear four timesi.e. a total of 5'899 UNIQUE OEMs (5'523+317+56+3)
Hope this will help
-
-
Thanks
-
-
-
Here is a VBA solution that I believe will remove your duplicates.
Code
Display MoreOption Explicit Sub DeleteDuplicateRows() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' DeleteDuplicateRows ' This will delete duplicate records, based on the Active Column. That is, ' if the same value is found more than once in the Active Column, all but ' the first (lowest row number) will be deleted. ' ' To run the macro, select the entire column you wish to scan for ' duplicates, and run this procedure. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim r As Long Dim n As Long Dim v As Variant Dim rng As Range On Error GoTo EndMacro Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Set rng = Application.Intersect(ActiveSheet.UsedRange, _ ActiveSheet.Columns(ActiveCell.Column)) Application.StatusBar = "Processing Row: " & Format(rng.Row, "#,##0") n = 0 For r = rng.Rows.Count To 2 Step -1 If r Mod 500 = 0 Then Application.StatusBar = "Processing Row: " & Format(r, "#,##0") End If v = rng.Cells(r, 1).Value ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Note that COUNTIF works oddly with a Variant that is equal to vbNullString. ' Rather than pass in the variant, you need to pass in vbNullString explicitly. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If v = vbNullString Then If Application.WorksheetFunction.CountIf(rng.Columns(1), vbNullString) > 1 Then rng.Rows(r).EntireRow.Delete 'rng.Rows(r).EntireRow.Copy Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row + 1 n = n + 1 End If Else If Application.WorksheetFunction.CountIf(rng.Columns(1), v) > 1 Then rng.Rows(r).EntireRow.Delete 'rng.Rows(r).EntireRow.Copy Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row + 1 n = n + 1 End If End If Next r EndMacro: Application.StatusBar = False Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic MsgBox "Duplicate Rows Deleted: " & CStr(n) End Sub
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!