Try this
Sub ConcatenateMultipleData()
Dim LastRow As Long
Dim Cell As Range
Dim strCode As String, strConc As String
Sheets("Raw Data").Activate
LastRow = Range("F" & Rows.Count).End(xlUp).Row
Range("E3:F" & LastRow).Sort Key1:=Range("F3"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
For n = 4 To LastRow
strConc = Range("F" & n)
strCode = Left(strConc, 3)
Do While Left(Range("F" & n + 1), 3) = strCode
strConc = strConc & "&" & Range("F" & n + 1)
n = n + 1
Loop
If InStr(1, strConc, "&") > 0 Then
With Sheets("Output")
If .Range("D" & Rows.Count).End(xlUp).Row < 5 Then
.Range("D5") = strConc
Else
.Range("D" & .Range("D" & Rows.Count).End(xlUp).Row + 1) = strConc
End If
End With
End If
Next
End Sub
Your sample data doesn't show many variations of what your real data might look like.
I've taken a guess and added some "possibilities"
Best I can do based on info provided.
Hope this helps.
Bookmarks