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!
 

Domski

Well-known Member
Joined
Jan 18, 2005
Messages
7,292
Hi,

Can there be more than 2 entries per name combination?

Dom
 

charleskavazy

New Member
Joined
Jun 19, 2008
Messages
3
Hi Domski

Thanks for responding

Unfortunately yes there can be more than 2. I think 4 rows is the maximum.
 

Domski

Well-known Member
Joined
Jan 18, 2005
Messages
7,292
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
 

Forum statistics

Threads
1,081,767
Messages
5,361,164
Members
400,617
Latest member
barron1

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top