Sub ReorgData()
' hiker95, 11/19/2014, ME819244
Dim o As Variant, j As Long, c As Long, mc As Long
Dim Rng As Range, nlr As Long
Dim r As Long, lr As Long, rr As Long, sr As Long, er As Long, n As Long
Application.ScreenUpdating = False
lr = Cells(Rows.Count, 1).End(xlUp).Row
Set Rng = Range("A2:A" & lr)
nlr = CountUnique(Rng)
ReDim o(1 To nlr, 1 To lr)
For r = 2 To lr
n = Application.CountIf(Columns(1), Cells(r, 1).Value)
If n > mc Then mc = n
If n = 1 Then
j = j + 1
o(j, 1) = Cells(r, 1).Value: o(j, 2) = Cells(r, 2).Value
ElseIf n > 1 Then
j = j + 1
o(j, 1) = Cells(r, 1).Value: o(j, 2) = Cells(r, 2).Value
c = 3
sr = r + 1: er = sr + n - 2
For rr = sr To er
o(j, c) = Cells(rr, 2).Value
c = c + 1
Next rr
End If
r = r + n - 1
Next r
Range("A2:B" & lr).ClearContents
Cells(1, 3).Resize(, mc - 1).Value = Cells(1, 2).Value
Range("A2").Resize(UBound(o, 1), UBound(o, 2)).Value = o
Columns(1).Resize(, 2 + mc).AutoFit
Application.ScreenUpdating = True
End Sub
Function CountUnique(ByVal Rng As Range) As Long
' Juan Pablo González, MrExcel MVP, 05/09/2003
' http://www.mrexcel.com/forum/excel-questions/48385-need-count-unique-items-column-visual-basic-applications.html
Dim St As String
Set Rng = Intersect(Rng, Rng.Parent.UsedRange)
St = "'" & Rng.Parent.Name & "'!" & Rng.Address(False, False)
CountUnique = Evaluate("SUM(IF(LEN(" & St & "),1/COUNTIF(" & St & "," & St & ")))")
End Function