I can't see an easy way to get the string ordered the way you demonstrate, but this will put each code into the string one time and collect the totals at the end.
Assuming the data is in column A, run this:
Option Explicit
Sub MergeDataSets()
Dim MyArr As Variant, m As Long, CTSlng As Long, IBMlng As Long
Dim CODErng As Range, c As Range, CTSstr As String, IBMstr As String
CTSstr = "/"
IBMstr = "/"
Set CODErng = Range("A:A").SpecialCells(xlConstants)
For Each c In CODErng
If InStr(c, "/") > 0 Then
MyArr = Split(c, "/")
Select Case Left(MyArr(UBound(MyArr)), 3)
Case "cts"
For m = LBound(MyArr) To UBound(MyArr) - 1
If InStr(CTSstr, "/" & MyArr(m) & "/") = 0 Then
CTSstr = CTSstr & MyArr(m) & "/"
End If
Next m
CTSlng = CTSlng + CLng(Replace(MyArr(UBound(MyArr)), "cts=", ""))
Case "ibm"
For m = LBound(MyArr) To UBound(MyArr) - 1
If InStr(IBMstr, "/" & MyArr(m) & "/") = 0 Then
IBMstr = IBMstr & MyArr(m) & "/"
End If
Next m
IBMlng = IBMlng + CLng(Replace(MyArr(UBound(MyArr)), "ibm=", ""))
End Select
End If
Next c
Range("E1") = Mid(CTSstr, 2, Len(CTSstr)) & "cts=" & CTSlng
Range("E2") = Mid(IBMstr, 2, Len(IBMstr)) & "ibm=" & IBMlng
End Sub
Bookmarks