you can try Power Query (excel 2016 and up)
simple version:
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Type = Table.TransformColumnTypes(Source,{{"Values", type text}}),
    GR = Table.Group(Type, {"Code"}, {{"GrBy", each Table.Transpose(Table.FromList([Values]))}}),
    Exp = Table.ExpandTableColumn(GR, "GrBy", {"Column1", "Column2", "Column3", "Column4"}, {"Column1", "Column2", "Column3", "Column4"}),
    Type2 = Table.TransformColumnTypes(Exp,{{"Column1", type number}, {"Column2", type number}, {"Column3", type number}, {"Column4", type number}})
in
    Type2
A
B
C
D
E
F
G
H
I
1
Code Values Code Column1 Column2 Column3 Column4
2
1001
2101
1001
2101
5205
2605
9285
3
1001
5205
2604
4256
7458
3555
4
1001
2605
5
1001
9285
6
2604
4256
7
2604
7458
8
2604
3555