このマクロを試して、必要に応じて調整してください。
Sub GroupMyData()
'Assuming the data source is in column F and G, from row 2 to 1000
'The result will be put in column K and L
'part1: filter to unique values, put in column J temporarily
Range("F2:F1000").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("J2" _
), Unique:=True
'part2: fill the data
Range("K1") = Range("F1")
Range("L1") = Range("G1")
Range("J2").Select
Range(Selection, Selection.End(xlDown)).Select
n = Selection.Count
Range("K2").Select
ck = 2
cl = 2
For i = 1 To n
txt = Range("J" & (i + 1))
numf = WorksheetFunction.CountIf(Range("F2:F1000"), txt)
For j = 1 To numf
Range("K" & ck) = txt
ck = ck + 1
Next
numg = WorksheetFunction.CountIf(Range("G2:G1000"), txt)
For j = 1 To numg
Range("L" & cl) = txt
cl = cl + 1
Next
If (ck > cl) Then
cl = ck
Else
ck = cl
End If
ck = ck + 1
cl = cl + 1
Next
'part 3: delete the temporary data
Range("J2:J1000").Select
Selection.ClearContents
Range("K2").Select
End Sub