Sub GroupData()
Dim ws As Worksheet
Set ws = ActiveSheet
Dim lastRow As Long
Dim key As Variant
Set ws = ThisWorkbook.Worksheets("Sheet2") 'Change sheet name to suit
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row 'Assumes data starts in A
Dim data As Variant
data = ws.Range("A2:D" & lastRow).Value 'Assumes data starts in row 2
Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary")
Dim i As Long
For i = 1 To UBound(data, 1)
key = data(i, 1)
If Not dict.exists(key) Then
dict.Add key, ""
End If
Dim j As Long
For j = 2 To 4 ' 4 columns: Asset, Name1, Name2, Name3
If data(i, j) <> "" Then
If dict(key) = "" Then
dict(key) = data(i, j)
Else
dict(key) = dict(key) & " " & data(i, j)
End If
End If
Next j
Next i
Dim resultRow As Long
resultRow = dict.Count
Dim resultArray() As Variant
ReDim resultArray(1 To resultRow, 1 To 4) ' 4 columns: Asset, Name1, Name2, Name3
Dim rowIndex As Long
rowIndex = 1
For Each key In dict.Keys
resultArray(rowIndex, 1) = key
Dim values() As String
values = Split(dict(key), " ")
Dim colIndex As Long
For colIndex = 0 To UBound(values)
resultArray(rowIndex, colIndex + 2) = values(colIndex)
Next colIndex
rowIndex = rowIndex + 1
Next key
' Output to F2
ws.Range("F2").Resize(UBound(resultArray, 1), UBound(resultArray, 2)).Value = resultArray
End Sub