Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to eliminate duplicates from mailing list

Status
Not open for further replies.

calihiker

Technical User
Jun 13, 2003
96
US
Does anyone know of good algorithms that eliminates duplicates from a mailing list using in-depth match coding? Also, the list includes the typical name aliases like robert, bob, rob etc. The mailing list I have is very dirty, in that sometimes the middle initial is appended to the first name, the addresses for the same person can be slightly off i.e. including abbreviation and extra words and the other duplicate names has the street spelled out fully and doesn't have extra words...etc. I have first name, last name, address1, address2, city, state, zip, phone number (uses hyphens sometimes, other times uses parentheses and sometimes nothing), custno, email address and a couple other fields to use. Any help would be greatly appreciated!! Thanks.
 
If you bring the data into excel you can use formulas to apply any rules you have for processing the data (ie remove all brackets in the address, if you want to ignore brackets). The following routine will delete any rows whose first two cells are duplicates. You will need to sort your data by these two columns.


Sub DeleteDuplicates()
Dim count As Integer
Dim NextRow As String, CurrentRow As String
Dim CurrentCell As Range, nextcell As Range

Set CurrentCell = Activesheet.Range("A2")
Do While Not IsEmpty(CurrentCell)
Set nextcell = CurrentCell.Offset(1, 0)
NextRow = nextcell.Value & nextcell.Offset(0, 1)
CurrentRow = CurrentCell.Value & CurrentCell.Offset(0,1)

If NextRow = CurrentRow Then
CurrentCell.EntireRow.Delete
count = count + 1

End If
Set CurrentCell = nextcell
Loop
MsgBox count & " Duplicates removed"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top