Excel duplicates removal but with a twist !

charleskavazy

New Member
Joined
Jun 19, 2008
Messages
3
I would really appreciate some Excel help to remove "partial duplicates but with a twist".

Here is an example of what I mean:

Eg. I have two rows , row one is Fred Blogs Cat (in columns A, B and C on row 1) and the second row, Fred Blogs Dog (in columns A, B and C on row 2) and I want to end up with one row Fred Blogs Cat Dog (in columns A, B, C and D on row 1) and the second row is deleted.

I have over 80,000 rows to deal with so some help would be really, really appreciated!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Try this but make sure you've got you're data saved as have not thoroughly tested it:

Code:
Sub De-Dup_Sort_Of()
Dim lastRow As Long, myRow As Long, writeRow As Long, writeCol As Long
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
writeCol = 3
writeRow = 2
For myRow = 2 To lastRow
If Cells(myRow, 1) & "_" & Cells(myRow, 2) = Cells(myRow + 1, 1) & "_" & Cells(myRow + 1, 2) Then
writeCol = writeCol + 1
Cells(writeRow, writeCol) = Cells(myRow + 1, 3)
Else
writeCol = 3
writeRow = myRow + 1
End If
Next myRow
For myRow = lastRow To 2 Step -1
If Cells(myRow, 1) & "_" & Cells(myRow, 2) = Cells(myRow - 1, 1) & "_" & Cells(myRow - 1, 2) Then
Cells(myRow, 1).EntireRow.Delete
End If
Next myRow
End Sub

Sort your data by column A and B before you run it.

Hope it helps,

Dom
 
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,796
Members
448,994
Latest member
rohitsomani

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