How to transpose your rich data into panel (Data Stacking / Transpose)

If you are in finance research area, and you are using panel data, the most annoying part is stacking/transpose your time series into panel data. Hereby, I give you the macros in excel (even though I know many software such Tableau can do it faster) to do in a click.

Yet, when you want to run it, adjust it with the number of your column. Mine is 6, and the data that has to be stacked/transposed is from column 2. Therefore, the i = 2 to 6.

Happy trying

Copy paste this to your macros (open your excel –> view –> macros –>view macros –> create –> copy paste –> run)

Sub SORTIR()
Dim rng As Range
For i = 2 To 6
Set rng = Range(Cells(1, i), Cells(1, i).End(xlDown))
rng.Cut Cells(Rows.Count, 2).End(xlUp)(2)
Next i
End Sub

Rayenda

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s