Excel lead merge

mrjjman

New Member
Joined
Oct 2, 2014
Messages
3
Hey Everyone, I have lead lists I'm working on, but sometimes there are duplicates, where 1 will have the email address and the other will have the date of birth. I don't want to get rid of both, but I want to merge them. For example:

First Name Last Name Email Birthday Phone
John Smith 1@1.com 404-555-1212
John Smith 01/01/1960 404-555-1212

I would like it to be like this:
First Name Last Name Email Birthday Phone
John Smith 1@1.com 01/01/1960 404-555-1212

So only 1 lead is left. I have alot of these, so an automatic or VBA method would be needed. The phone field would be unique and could be a good merge anchor. Ideas?
 
With the leads, only 1 email address would show. But the phone would be the same to use an an anchor merge field
 
Upvote 0
Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim lRow As Long, i As Long
With ActiveSheet
  .UsedRange
  lRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
  With .Sort
    With .SortFields
      .Clear
      .Add Key:=Range("E2:E" & lRow), SortOn:=xlSortOnValues, _
        Order:=xlAscending, DataOption:=xlSortNormal
      .Add Key:=Range("B2:B" & lRow), SortOn:=xlSortOnValues, _
        Order:=xlAscending, DataOption:=xlSortNormal
      .Add Key:=Range("A2:A" & lRow), SortOn:=xlSortOnValues, _
        Order:=xlAscending, DataOption:=xlSortNormal
    End With
    .SetRange Range("A1:E" & lRow)
    .Header = xlYes
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
  End With
  For i = lRow - 1 To 2 Step -1
    If .Range("E" & i).Value = .Range("E" & i + 1).Value Then
      If .Range("A" & i).Value = .Range("A" & i + 1).Value Then
        If .Range("B" & i).Value = .Range("B" & i + 1).Value Then
          If .Range("C" & i).Value = "" Then
            .Range("C" & i).Value = .Range("C" & i + 1).Value
          End If
          If .Range("D" & i).Value = "" Then
            .Range("D" & i).Value = .Range("D" & i + 1).Value
          End If
          .Rows(i + 1).EntireRow.Delete
        End If
      End If
    End If
  Next
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0

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