Sub test()
Dim repNames() As String
Dim tempNames() As String
Dim lRow As Integer
lRow = Cells(Rows.Count, 6).End(xlUp).Row
Dim ii As Integer
ii = 0
For i = 1 To lRow
If InStr(Cells(i, 6).Value, "&") > 0 Then
tempNames = Split(Cells(i, 6).Value, "&")
For Each tempName In tempNames
repNames(ii) = Trim(tempName)
ii = ii + 1
Next
Else
repNames(ii) = Cells(i, 6).Value
ii = ii + 1
End If
Next
For i = ii - 1 To 0 Step -1
For iii = i To 1 Step -1
If repNames(i) = repNames(iii) Then
repNames(i) = ""
End If
Next
Next
[QUOTE="Flashbond, post: 5969705, member: 143009"]
I wrote this one really in an hurry. Most probably It won't work :) Please send sample data to work on it (not as an image)
[CODE=vba]Sub test()
Dim repNames() As String
Dim tempNames() As String
Dim lRow As Integer
lRow = Cells(Rows.Count, 6).End(xlUp).Row
Dim ii As Integer
ii = 0
For i = 1 To lRow
If InStr(Cells(i, 6).Value, "&") > 0 Then
tempNames = Split(Cells(i, 6).Value, "&")
For Each tempName In tempNames
repNames(ii) = Trim(tempName)
ii = ii + 1
Next
Else
repNames(ii) = Cells(i, 6).Value
ii = ii + 1
End If
Next
For i = ii - 1 To 0 Step -1
For iii = i To 1 Step -1
If repNames(i) = repNames(iii) Then
repNames(i) = ""
End If
Next
Next
For i = 0 To ii - 1
If repNames(i) <> "" Then
Cells(i + 1, 8).Value = repNames(i)
End If
Next
iii = Cells(Rows.Count, 8).End(xlUp).Row
For i = 1 To iii
For ii = 1 To lRow
If InStr(Cells(ii, 6).Value, Cells(i, 8).Value) > 0 Then
If InStr(Cells(ii, 6).Value, "&") > 0 Then
Cells(i, 9).Value = Cells(i, 9).Value + (Cells(ii, 6).Value / ((Len(Cells(ii, 6).Value) - Len(Replace(Cells(ii, 6).Value, "&", ""))) + 1))
Else
Cells(i, 9).Value = Cells(i, 9).Value + Cells(ii, 6).Value
End If
End If
Next
Next
End Sub