Question : Pivot Multiple Column Entries to Rows?

I have a unique identifier. We'll call it a product code.
For each Product Code there are multiple cross references (anywhere up to 32) We'll call them Part Numbers.
Currently each product code only appears once and each cross reference for it appears in a new field in the same row. A rough example appears below:

Product Code,            Part Number 1,            Part Number 2,            Part Number 3,          Part Number 4     Part Number 5
0001                                 ABC                               DEF                             HIJ                             KLM                      ETC
0002                                 NOP                               QRS                            TUV
0003                                 WXY                              


What i want to end up with is just 2 fields, Product Code and Part Number but multiple rows for each product code.
Again a rough example below:

Product Code ,    Part Number
0001                          ABC
0001                          DEF
0001                           HIJ
0001                          KLM
0002                           NOP
0002                          QRS
0002                          TUV
0003                          WXY

Im not sure if this can be done with a Pivot table as ive never really used them before. I had a play with them, but couldnt get what i wanted. I then tried using an array, which im sure u can pivot somehow, but again no luck.

Im not even sure if this can be done in Excel but if someone can help i'll be eternally grateful!

Answer : Pivot Multiple Column Entries to Rows?

Okay i believe this is what you meant....

Saurabh...

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
Sub move()
Application.ScreenUpdating = False
 
    Dim i As Long, k As Long, u As Long
    i = 2
    Do Until i > Cells(65536, "A").End(xlUp).Row
        If Cells(i, "A").Value <> "" Then
            k = i
            u = 4
            Do Until u > Cells(k, "IV").End(xlToLeft).Column
                If Cells(k, u).Value <> "" Then
                    Rows(i + 1).Insert
                    Cells(i + 1, "B").Value = Cells(k, u).Value
                    Cells(i + 1, "c").Value = Cells(k, u + 1).Value
                    Cells(i + 1, "A").Value = Cells(k, "A").Value
                    Cells(k, u).ClearContents
                     Cells(k, u + 1).ClearContents
                    i = i + 1
                    u = u + 2
                Else
                    u = u + 2
                End If
            Loop
        End If
 
        i = i + 1
    Loop
 
MsgBox "Done"
 
Application.ScreenUpdating = True
 
End Sub
Random Solutions  
 
programming4us programming4us