Hello speedyhub,
Finally I've created code for You - follow below points
1. sort your source array regarding ID
2. use provided procedure (copy it into module or to source code of your sheet)
3. use autofilter for get expected result
Sub GiveMeTransposeResult()
'Author: MaczaQ
Dim sAddr As String, source, tmp, cl As Range, colOffset as Integer
Set source = Range("A3:B20") '<<<<------------------------------SOURCE-------------------------------------
'other way to set up source range if you want to select your source data just unhash below code
'Set source = Selection
colOffset = source.Columns.Count
With source.Columns(1)
Set tmp = .Cells(1, 1)
For Each cl In .Cells
'all groups excluding last group
If cl.Value <> tmp.Value And cl.Address <> .Cells(.Cells.Count, 1).Address Then
sAddr = tmp.Address & ":" & cl.Offset(-1).Address
arr = Application.Transpose(Range(sAddr).Offset(, 1))
If tmp.Address <> cl.Offset(-1).Address Then
Range(tmp.Address).Offset(, colOffset).Resize(, UBound(arr)).Value = arr
Else
Range(tmp.Address).Offset(, colOffset).Value = arr
End If
Set tmp = cl
End If
'last group
If cl.Address = .Cells(.Cells.Count, 1).Address Then
sAddr = tmp.Address & ":" & cl.Address
arr = Application.Transpose(Range(sAddr).Offset(, 1))
If tmp.Address <> cl.Offset(-1).Address Then
Range(tmp.Address).Offset(, colOffset).Resize(, UBound(arr)).Value = arr
Else
Range(tmp.Address).Offset(, colOffset).Value = arr
End If
End If
Next cl
End With
End Sub
If you will need any more help do not hasitate to post it.
Bookmarks