You can use the following VBA code to remove duplicates from a delimited list.
Public Function RemoveDuplicates(list As String, delimiter As String) As String
Dim arrSplit As Variant, i As Long, tmpDict As Object, tmpOutput As String
Set tmpDict = CreateObject("Scripting.Dictionary")
arrSplit = Split(list, delimiter)
For i = LBound(arrSplit) To UBound(arrSplit)
If Not tmpDict.Exists(arrSplit(i)) Then
tmpDict.Add arrSplit(i), arrSplit(i)
tmpOutput = tmpOutput & arrSplit(i) & delimiter
End If
Next i
If tmpOutput <> "" Then tmpOutput = Left(tmpOutput, Len(tmpOutput) - Len(delimiter))
RemoveDuplicates = tmpOutput
'housekeeping
Set tmpDict = Nothing
End Function
Sub ZapDuplicatesInPlace()
Dim r As Range, va() As Variant
Set r = Application.InputBox("Select range to remove duplicates cell by cell.", "Remove Duplicates From Lists", , , , , , 8)
va = r.Value
For i = LBound(va, 1) To UBound(va, 1)
For j = LBound(va, 2) To UBound(va, 2)
'This assumes delimiter is comma followed by space.
va(i, j) = RemoveDuplicates(CStr(va(i, j)), ", ")
Next j
Next i
'Print output to sheet
r.Value = va
End Sub
There are two ways you can use this code to achieve what you want.
If you want to remove the duplicates in place, i.e., if you want to clean the data you have and delete the duplicates forever, you can run the ZapDuplicatesInPlace sub. It will prompt you to select a range that you want it to process. Each cell in the range will be stripped of duplicates.
If you would rather use worksheet functions to leave your original data intact, you can use the function RemoveDuplicates in a formula. For example, if you have Smith, Miller, Patty, Smith, Patty, Miller in A1, you can use the formula below in another cell to return the list minus the duplicates.
=RemoveDuplicates(A1,", ")
For instructions for using VBA in your workbook, see this post.