A picture is worth a thousand words. Let's say in one sheet I have the following table:

Using this information, I want to programatically generate the table like this(sort of un-melting the long table into the wide form) in another sheet:

How can you achieve this?
Using VBA:
Range("G1:K99").Clear For Each xx In Range("A:A") If xx.Value = "" Then Exit Sub Range("G1").Offset(xx.Value, 0) = xx.Value For e = 1 To 99 If Range("G1").Offset(xx.Value, e) = "" Then Range("G1").Offset(xx.Value, e) = xx.Offset(0, 1).Value Exit For End If Next Next
The table it's created from column "G". If you want another sheet:
Sheets(2).Range("G1: ...
add the Sheets before ...
Without VBA, following the scheme:

Adding the formulas:
M2 -> =IFERROR(MATCH(L2;$A$1:$A$8;);"") N2 -> =IFERROR(MATCH(L2;INDIRECT("$A" & (M2+1) & ":$A$8");)+M2;"") O2 -> =IFERROR(MATCH(L2;INDIRECT("$A" & (N2+1) & ":$A$8");)+N2;"") P2 -> =IFERROR(INDEX($B$1:$B$8;M2);"") Autocomplete also columns to R
and Autocomplete ...
I can see another approach as well. Add two columns Count and Key.

Add the formulas and expand:
C2 -> =COUNTIF($B$2:B2;B2) D2 -> =B2&"|"&C2 G2 -> =IFERROR(INDEX($A:$A;MATCH($F2&"|"&COLUMN(A1);$D:$D;0));"")