+ Reply to Thread
Results 1 to 33 of 33

transposing many data in columns from rows (different sheets)

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    transposing many data in columns from rows (different sheets)

    Hi! how about if I want to transpose many columns of data into rows and in different sheets?

    here is an example. But in reality, it is composed of different sheets (1 sheet per variable).

    I want the format to be like this:

    DATE (month/day/yr) Variable 1 Variable 2 Variable 3

    jan 1, 1999 3 4 5

    up to

    jan 31, 1999 6 7 8



    The raw data contains many years. I wish to have the format like the above one. 1 year per sheet.
    Attached Files Attached Files

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    You need to explain a little more. Maybe show us a before and after sheet so we can understand what really you need.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Hi Arlu! here is the before and after files.

    Please note that the data I will be using is not limited to 5 branches and 4 years. That's why I really need help. Thanks!
    Attached Files Attached Files

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    Try this code - Have toiled for hours to get this working for you -
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button

  5. #5
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Hi arlu! Thanks for the code! I can't believe this that was really cool and amazing! You really are a genius!
    By the way I want to ask what will I change if the branches will have different names as the labels (B1;C1;D1;etc). For example I will not label it as branch A but as "max" branch B as "min" etc etc.

    Thanks for your brilliance!

  6. #6
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    It also doesnt work if the column with months Jan-Dec is replaced with 1-2-3-4-5-6-7-8-9-10-11-12..
    And another problem I forgot to tell you that there maybe some missing data.. For example there is no data for a month. It turned out that the transforming is continuous even if there is no data so the data is misplaced during transformation.

  7. #7
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Hi! There's some data missing but I want it to be formated the right way (data corresponding to the right date). The code doesnt work. pls see attached. Please. Thanks so much!
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Btw, the date should be displayed even though they dont have corresponding data. Thanks! Im sorry if this causes much confusion> I hope you are able to comprehend my wishes? my apologies for causing difficulties.

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    Quote Originally Posted by moniquem View Post
    Hi arlu! Thanks for the code! I can't believe this that was really cool and amazing! You really are a genius!
    By the way I want to ask what will I change if the branches will have different names as the labels (B1;C1;D1;etc). For example I will not label it as branch A but as "max" branch B as "min" etc etc. Thanks for your brilliance!
    Will the sheet names have the word "branch" in them? The columns will not get affected but the sheet names will cause an issue in the code.

    Quote Originally Posted by moniquem View Post
    It also doesnt work if the column with months Jan-Dec is replaced with 1-2-3-4-5-6-7-8-9-10-11-12..
    And another problem I forgot to tell you that there maybe some missing data.. For example there is no data for a month. It turned out that the transforming is continuous even if there is no data so the data is misplaced during transformation.
    Ok, i will need to re-work the code for this.

    Quote Originally Posted by moniquem View Post
    Hi! There's some data missing but I want it to be formated the right way (data corresponding to the right date). The code doesnt work. pls see attached. Please. Thanks so much!
    Ok, yes i will need to check and re-work the code for this part.

    Quote Originally Posted by moniquem View Post
    Btw, the date should be displayed even though they dont have corresponding data. Thanks! Im sorry if this causes much confusion> I hope you are able to comprehend my wishes? my apologies for causing difficulties.
    Ok, i will add this part into the code.

  10. #10
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Thanks for the help! The sheet names dont actually have "branch" in it. They are different parameters. Btw when can I check the new code? thanks a lot!

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    So is it ok if the output is given in a new workbook?

  12. #12
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Yes it is okay.

  13. #13
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Actually it is better if the output is in a new workbook.

  14. #14
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Any update pls?

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    Try this updated code - I am not able to put in the dates into the 1st column - let me know if its too much of a headache to do it manually. I will try and break my head to put in some logic for that -
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Hi! It is okay if the data is not put into the first column. I can drag it.

    Thanks for the code but there are errrs:
    1. There are always 3 spaces before the 1st day of march; another space before may; july; and october. So the data is offset by 7spaces. So data is misplaced.

    2. If there is missing data for a month or for a couple of months the data seems to be misplaced (e.g. Ted data goes into the Barney column)

  17. #17
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    Ok, yeah it creates an issue because the number of days in each month is not the same.

    I will need to check again how i can make the logic better. I may need to redo the code.

  18. #18
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Thanks again! Hope to hear from you again. Sorry if it's laborious.

  19. #19
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    bump
    any update?

  20. #20
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Hi! I've used the code given by arlu, and I realized I don't really need an upadated code.. I correct the error manually by careful observation since they are minamal. Thank you very much Arlu!

    Do I need to close this thread now? I have a different set and format of data that I want to transform like we did here but I guess the approach will be different since we will not be dealing with rows. Can I post it here?

  21. #21
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    Did you use the 2nd code? Yes, you can mark this as solved.

    Since the question is different, you need to post it in a new thread.

  22. #22
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Yes, I used the 2nd code. Thank you very much, Arlu! You're brilliant!

  23. #23
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    Am glad its solved.

  24. #24
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    What modification does it need so it would not be just pasted but pasted LINKED? Need help again.

  25. #25
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    bump.. any update?

  26. #26
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    Usually, once a thread is solved, i unsubscribe from it so i dont get any notifications. So please PM me if i dont reply to you.

    What do you mean by linked? You want the formulae to be in there and not the values?

  27. #27
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Thanks for the reply, Arlu!
    No, the formula must not be posted but it should be pasted link. For example, in sheet 2, cell A1, the content is Sheet1!B1. It means that in sheet2 A2, the content in sheet 1 B2 is reflected. So when I change the value in sheet 1, the value in sheet 2 will be automatically changed.

  28. #28
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    So you do not want the macro to populate the data for you but to populate the data via formula?

  29. #29
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    No. I just want the data to be pasted TRANSPOSE and LINK. I dont know if it's confusing but I cant explain it very well.

  30. #30
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    Here is what I mean with paste link. But I dont know it it is possible to transpose while linking simultaneously.
    Attached Files Attached Files

  31. #31
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    Your sample file in post 30 shows the data in sheet2 not transposed but linked. Do you want it only linked?

  32. #32
    Registered User
    Join Date
    01-29-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: transposing many data in columns from rows (different sheets)

    no i want it to be transposed and linked but i cant do it.

  33. #33
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: transposing many data in columns from rows (different sheets)

    Any reason why you want it that way? Its going to make your work all the more complicated.

    If you want to do it so as to include any changes done to the main file, then you can have the macro run each time a change is done.

+ Reply to 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