Closed Thread
Results 1 to 11 of 11

Change large table into panel data format

  1. #1
    Registered User
    Join Date
    09-29-2011
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    8

    Change large table into panel data format

    Hi,

    I always search in forums for my answer, but in this case I don't know how to search for it, so I might ask for something that is elaborately discussed. What I need is a VBA macro or something that can reshape my table:

    company Identifier 2001 2002 2003
    a x 1 11 111
    a y 2 12 111
    a z 3 13 111
    b x 4 14 111
    b y 5 15 111
    b z 6 16 111
    c x 7 17 111
    c y 8 18 111
    c z 9 19 111



    To something like this

    company year x y z
    a 2001 1 2 3
    a 2002 11 12 13
    a 2003 111 111 111
    b 2001 4 5 6
    b 2002 14 15 16
    b 2003 111 111 111
    c 2001 7 8 9
    c 2002 17 18 19
    c 2003 111 111 111


    Your help is greatly appreciated as I really need this to fix my thesis (and deadline is running towards me!)


    Grtz,

    Barbet
    Last edited by barbet; 06-22-2012 at 12:59 PM. Reason: Moterator Requirements

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Panel data

    Can you upload a worksheet with sample data? Or better yet, the real data?

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Panel data

    Don't ever post personal or confidential data in a workbook. If you inadvertently do, then click here and post a message to the moderators to have the data immediately and permanently deleted. Include a link to the post in the message.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Panel data

    Also,
    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.


  5. #5
    Registered User
    Join Date
    09-29-2011
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Change large table into panel data format

    Hi stevenm, thanx for your reply so soon. The data is confidential, but I have here a sample excel spreadsheet. If it works on this sheet, it will work on mine.
    Attached Files Attached Files

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Change large table into panel data format

    Slightly complicated...

    I think you should rearange your data to use it with Pivot table...

    But here:
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-29-2011
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Change large table into panel data format

    You're awesome, I tried a pivot, but didn't get the desired result properly. I'm gonna try it now

  8. #8
    Registered User
    Join Date
    08-19-2012
    Location
    Coventry, England
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Change large table into panel data format

    Hi

    I would like to ask if the suggested idea worked out for you? If not, then how did you solve the problem?

    I have similar problem, I have a data set of 535 companies, with daily stock returns for 20 years.

    Kind regards

  9. #9
    Registered User
    Join Date
    09-29-2011
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Change large table into panel data format

    It worked. You'll have to combine it with the 'transpose function' and 'pivot table' function in excel. In that way you can turn your table around as much as you like. Use zbor's code and you'll be fine! Btw, zbor: thanx a lot for your help!

  10. #10
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Change large table into panel data format

    Hello Zaub, and welcome to the forum.

    Unfortunately you have inadvertently broken one of the forum rules. Please read the following and make the necessary change. Thanks.

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

  11. #11
    Registered User
    Join Date
    11-22-2012
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Change large table into panel data format

    An excellent way to do the conversion is to use the inbuilt features of Stata as suggested by Angel here http://angelsmarrero.blogspot.ca/201...-in-stata.html

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1