Rearranging data in form of Panel Data

leonelcd

New Member
Joined
Apr 17, 2014
Messages
7
Hello guys,


Is there any way to rearrange data in this way for the following:


: BEFORE:

/////////[Ticker A] [Ticker B] [Ticker C]
2010 ///// 0,3 ////// 0,6 /////// 0,9
2011 ///// 0,7 ////// 1,4 /////// 2,1
2012 ///// 1,3 ////// 2,6 /////// 3,9

: LATER :

2010 Ticker A 0,3
2011 Ticker A 0,6
2012 Ticker A 0,9
2010 Ticker B 0,7
2011 Ticker B 1,4
2012 Ticker B 2,1
2010 Ticker C 1,3
2011 Ticker C 2,6
2012 Ticker C 3,9


Worth function, worth macro, what worth everything that's automate this process. Are spreadsheets with hundreds of rows.


Thanks!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
not sure what you are looking for as the end result as your later table makes no sense compared years to ticker to value but how about the following?

Code:
Sub ConvertTableToList()
Const TEST_COLUMN As String = "A"
Dim i As Long, j As Long
Dim iLastRow As Long
Dim iLastCol As Long
Application.ScreenUpdating = False
With ActiveSheet
iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 2 Step -1
iLastCol = .Cells(i, .Columns.Count).End(xlToLeft).Column
For j = iLastCol To 2 Step -1
.Rows(i + 1).Insert
.Cells(i + 1, 3).Value = .Cells(i, j).Value
.Cells(i + 1, 2).Value = .Cells(1, j).Value
.Cells(i + 1, 1).Value = .Cells(i, 1).Value
.Cells(i, j).Value = ""
Next j
.Rows(i).Delete xlUp
Next i
.Rows(1).Delete
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Hi hippiehacker, yes!

The only thing I want to change is the result: Could be in the different columns? Like this:

2010 //// Ticker A //// 0,3
2011 //// Ticker A //// 0,6
(...)
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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