+ Reply to Thread
Results 1 to 9 of 9

column into multiple columns

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

    Smile column into multiple columns

    hi there. I am trying to work on a piece of code to convert a long column of half hourly energy data (several years worth) into 48 columns (one representing each half hourly value). I have being doing it manually using the offset function, but now the amount of data is getting too large, so VBA is the way forward. So basically each days worth of data (48 values for each half hour) will be in a separate row... hope this makes sense

    any help or kick in the right direction would be great

    thanks

    Rich



  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: column into multiple columns

    attach a sample file with current and desired table
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: column into multiple columns

    Hi, Rich,

    maybe this code can guide you into the direction:
    Please Login or Register  to view this content.
    You should adapt the Columns (here Column A has the data, and from Column C on the values will be shown) and the rows for the starting data as well for the target. If you want the macro to be running faster you could use Application.ScreenUpdating = False at the start and ~ = True at the end.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

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

    Re: column into multiple columns

    thanks for the reply, and sorry for not posting an example. Please see attached for what i am looking for. Thanks HaHoBe, will have a look at your code

    Rich
    Attached Files Attached Files

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

    Re: column into multiple columns

    Hi i tried the code above, and it sort of works. It produces the 48 columns (perfect), but how do you get it to continually transpose the data until there is no more data in the data column? the code writes 2 rows then stops

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: column into multiple columns

    Hi, Rich,

    sorry I didnīt go for the row of the last entry but for the value. Maybe give this modification a try:
    Please Login or Register  to view this content.
    Ciao,
    Holger

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: column into multiple columns

    The attahed code also can work if your data follow the same format consistently.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: column into multiple columns

    maybe with an pivot table.

    see the attached file.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  9. #9
    Registered User
    Join Date
    01-29-2013
    Location
    scotland
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: column into multiple columns

    awesome, thanks for all your help. all seem to work really well. Absolute time saver!!!

+ 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