С такими ячейками, как:
Выберите ячейки, которые вы sh обрабатываете, и запустите этот макрос VBA:
Sub deDupl()
Dim cell As Range, chr10 As String, arr
Dim c As Collection, a, temp As String
Dim i As Long
chr10 = Chr(10)
For Each cell In Selection
arr = Split(decap(cell.Value), chr10)
Set c = New Collection
On Error Resume Next
For Each a In arr
c.Add a, CStr(a)
Next a
On Error GoTo 0
temp = ""
For i = 1 To c.Count
temp = IIf(temp = "", c.Item(i), temp & chr10 & c.Item(i))
Next i
cell.Value = encap(temp)
Next cell
End Sub
Public Function decap(s As String) As String
decap = Mid(s, 2, Len(s) - 2)
End Function
Public Function encap(s As String) As String
encap = "(" & s & ")"
End Function
Ячейка после: