+ Reply to Thread
Results 1 to 10 of 10

How to transpose variable data from column A to multiple rows

  1. #1
    Registered User
    Join Date
    08-02-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    4

    How to transpose variable data from column A to multiple rows

    Trying to learn excel as best I can but came across something Im not sure how to do, so hopefully I can get some help here.

    I'm doing a mail merge and the data I pulled from our computer returned all the address data in one single column, but to do the merge you must have them in rows. Additionally, some addresses are more than 3 lines - some have as many as 6 - BUT everything is seperated by a blank row, so i think the formula could use that as a trigger to jump to the next line.

    So currently my data looks like this:

    Company A
    1234 Main St.
    Anytown, USA 12345
    <Space>
    Company B
    Attn. Mr. Smith
    1234 Main St.
    Anytown, USA 12345
    <Space>
    Company C
    1234 Main Street
    Sometown
    Australia
    123456
    <space>
    etc...

    And it needs to be

    Company A / 1234 Main St. / Anytown, USA 12345
    Company B / Attn. Mr. Smith / 1234 Main St. / Anytown, USA 12345
    Company C / 1234 Main Street / Sometown / Australia / 123456


    Does anyone have a formula or code code for this please? Im a VBA newb, but wanna learn. Thanks!!!
    Last edited by Davidko19; 08-02-2010 at 04:12 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How to transpose variable data from column A to multiple rows

    Hello Davidko19,

    Welcome to the Forum!

    Here is macro to convert the mail addresses from a single column into individual rows with multiple columns. This also sorts the addresses from A to Z order.
    Please Login or Register  to view this content.
    Adding the Macro
    1. Copy the macro above pressing the keys CTRL+C
    2. Open your workbook
    3. Press the keys ALT+F11 to open the Visual Basic Editor
    4. Press the keys ALT+I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL+V
    7. Make any custom changes to the macro if needed at this time.
    8. Save the Macro by pressing the keys CTRL+S
    9. Press the keys ALT+Q to exit the Editor, and return to Excel.

    To Run the Macro...
    To run the macro from Excel, open the workbook, and press ALT+F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    08-02-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How to transpose variable data from column A to multiple rows

    that worked perfect, thanks! Your the man!

    I just received a FAT Excel 2007 VBA programming book yesterday, so hopefully with some studying I can contribute some and learn what exactly what that code means

  4. #4
    Registered User
    Join Date
    03-06-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: How to transpose variable data from column A to multiple rows

    Tried to work with this same code to use with my data, but couldn't figure it out.

    I have a column with around 3500 entries and would like to tranpose it into several rows of 12 columns each.

    my data is like this:
    0
    0
    p
    0
    0
    0
    0
    0
    s1
    s2
    0
    s3
    0
    0
    p
    0
    0
    0
    0
    0
    0
    0
    0
    0

    and I would like to have:
    0 0 p 0 0 0 0 0 s1 s2 0 s3
    0 0 p 0 0 0 0 0 0 0 0 0


    Any help will be highly appreciated.

    Thanks

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How to transpose variable data from column A to multiple rows

    Hello gjesus,

    Welcome to the Forum!

    You shouldn't post a new question in an existing post. You should start a new thread and add a link back to the post that pertains to your question. When you have time, please read the forum rules. There is link at the top of the page in the menu bar "Forum Rules".

    Here is the code to transpose the data into columns of 12. The macro assumes the data starts in cell "A1" on "Sheet1". You can changes these to what you are using.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-06-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: How to transpose variable data from column A to multiple rows

    Hi Leith,

    Thank you very much for you help, it worked perfectly.
    In the future I shall use a new post for new questions.

  7. #7
    Registered User
    Join Date
    05-07-2013
    Location
    U.S.A
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: How to transpose variable data from column A to multiple rows

    Dear Leith,

    I have similar problem except the rows are longer and there 4 columns. After 96 rows or so there is a spaces and a new id is shown. I need the ids to be horizontal

    here is an example
    AHU 07_05-06-13_14-00.csv

    need to be like this
    AHU 06_05-06-13_13-59.new.csv

    Everything is exported into excel. I just need a vb code to spit the data out. I have over 75 versions of the example file that has to be cleaned up.
    Can you help out.

    Thanks in advance

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,918

    Re: How to transpose variable data from column A to multiple rows

    fubini89
    Welcome to the Forum.

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ben Van Johnson

  9. #9
    Registered User
    Join Date
    02-13-2014
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: How to transpose variable data from column A to multiple rows

    Want to ask. Ive around 7000 data in this excel sheet. When used this code, the conversion only consider the first row of item and repeating for another column which suppose to transpose exact value in exact field. If I minimized into small amount of data, I'm able to get correct tranform. How this happened? Is it because of too many data?

    Help me please.
    Thank you

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,044

    Re: How to transpose variable data from column A to multiple rows

    Hi deepearl and welcome to the forum

    Perhaps you missed the post directly above yours?

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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