Have data in "pivot format", what to transform it into "rows format"

OldManExcellor

New Member
Joined
May 30, 2011
Messages
45
I have data in Excel presented in what I would call "pivot format":
B1bEq.png


I want to transform that data into what I would call "rows format"
1fZM4.png

(so that I can later use it in pivot tables)

The data file I have is quite large. What is a fast and efficient way to transform the data from "pivot" to "rows" using either excel or access?
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
This vb code ought to help.

It creates the new layout on a fresh tab

You should run it when on the tab with the original data. This data should appear as in your image, IE, row heads in column A and column heads in row 1

Code:
Sub convertLayout()
    Dim src, dst, dr, r, c
    Application.ScreenUpdating = False
    Set src = ActiveSheet
    Set dst = Sheets.Add(after:=src)
    dr = 2
    With src
        lr = .Cells(Rows.Count, "A").End(xlUp).Row
        lc = .Cells(1, Columns.Count).End(xlToLeft).Column
    End With
    With dst
        For r = 2 To lr
            For c = 2 To lc
                .Cells(dr, 1) = src.Cells(r, "A")
                .Cells(dr, 2) = src.Cells(1, c)
                .Cells(dr, 3) = src.Cells(r, c)
                dr = dr + 1
            Next c
        Next r
        With .Range("A1:C1")
            .Value = Array("Row Head", "Column Head", "Value")
            .EntireColumn.AutoFit
        End With
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,266
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top