+ Reply to Thread
Results 1 to 7 of 7

Transposing Unequal, Repeating Rows to Columns

  1. #1
    Registered User
    Join Date
    06-26-2017
    Location
    Melbourne, FL
    MS-Off Ver
    2007
    Posts
    4

    Transposing Unequal, Repeating Rows to Columns

    Hello,

    I found the answer to this question about 6 months ago, but now it is eluding me.

    I'm trying to transpose ugly old data from an AS400 system into Excel. I don't want to put the actual information on a public forum, but a close approximation would look like this:

    Student 1, Street 1
    Student 1, City 1
    Student 1, Phone 1
    Student 1,
    Student 2, Street 2
    Student 2, Apartment 2
    Student 2, City 2
    Student 2, Phone 2
    Student 3, Street 3
    Student 3, City 3
    Student 3, Phone 3
    Student 4, Street 4
    Student 4, City 4
    Student 4, Phone 4
    Student 4,
    Student 5, Street 5
    Student 5, City 5
    Student 5,
    Student 5, Phone 5
    Student 5,
    Student 5,
    Student 5,

    As you can see, the data is a mess. Usually, the data is grouped into 4 rows, but sometimes it's 3 rows and other times more. Sometimes the data skips a line between the city and the phone number. Sometimes, there is no city listed, just a street name and number. Sometimes there are 3 or more blank lines after a listing.

    Column one is a student number, and column two is the various data types.

    Because the data is in such disarray, I don't see how any solution will be perfect. But, if I can at least break out the rows into columns, I think that I can figure it out from there. a good solution would look like this:

    Student 1, Street 1, City 1, Phone 1, *Blank
    Student 2, Street 2, Apartment 2, City 2, Phone 2
    Student 3, Street 3, City 3, Phone 3
    Student 4, Street 4, City 4, Phone 4, *Blank
    Student 5, Street 5, City 5, *Blank, Phone 5, *Blank, *Blank, *Blank

    From there, I can at least get started. Any help is much appreciated. Thanks!
    Last edited by z0wb13; 06-26-2017 at 08:36 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Transposing Unequal, Repeating Rows to Columns

    Hi and welcome to the forum.

    Is your data in a single column or two columns?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    06-26-2017
    Location
    Melbourne, FL
    MS-Off Ver
    2007
    Posts
    4

    Re: Transposing Unequal, Repeating Rows to Columns

    2 columns, I updated the original post to make this explicit.

    And thank you for the welcome.
    Last edited by z0wb13; 06-26-2017 at 08:36 AM.

  4. #4
    Registered User
    Join Date
    06-26-2017
    Location
    Melbourne, FL
    MS-Off Ver
    2007
    Posts
    4

    Re: Transposing Unequal, Repeating Rows to Columns

    So I messed around for a while and I came up with this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    That first IF statement is a little dodgy, especially as currentRow and currentCol haven't been initialized. It works, but if anyone would like to comment on how to make it a little more robust that would be great. Also, it seems really slow.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Transposing Unequal, Repeating Rows to Columns

    Try
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-26-2017
    Location
    Melbourne, FL
    MS-Off Ver
    2007
    Posts
    4

    Re: Transposing Unequal, Repeating Rows to Columns

    Wow! That works, and much faster.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Transposing Unequal, Repeating Rows to Columns

    If that takes care of your original question, select Thread Tools from the menu link above and mark this thread as SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. counting and naming unequal data in unequal length rows
    By faustfisher in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-30-2017, 07:28 AM
  2. [SOLVED] Transposing Rows to Columns 1-12, 13-24,25-36 etc
    By mralanb in forum Excel General
    Replies: 16
    Last Post: 03-04-2017, 10:26 AM
  3. Need help transposing rows into columns
    By mckeven in forum Excel General
    Replies: 4
    Last Post: 10-08-2014, 04:41 PM
  4. [SOLVED] Transposing 2 - 70,000+ long columns into approx 4600 rows with 15 columns each
    By Glennstapo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2014, 09:51 AM
  5. [SOLVED] Need help with transposing columns to rows
    By cheryl_granieri in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2013, 09:14 AM
  6. Replies: 8
    Last Post: 11-02-2011, 02:45 PM
  7. Transposing columns and rows
    By TEB2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2005, 01:06 PM

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