+ Reply to Thread
Results 1 to 18 of 18

convert single column to multiple columns

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    convert single column to multiple columns

    How can I sort a single column of data to multiple columns of data. e.g. I want to convert ~1800 rows of data from 1 column to 3 or 4 columns.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Text to Columns

    Maybe link will help

    http://www.bettersolutions.com/excel...M315128331.htm

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    I can't do it this way because of the way information is formatted. He cell contains a phrase. See example of data attached.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    No attachment

    VBA Noob

  5. #5
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    forgot to send attachment. Here is what data looks like:

    A1: a sure thing
    A2: above street expectation
    A3: beat earning expectation
    A4: below street expectation

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    and what should the results be

    VBA Noob

  7. #7
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    Attached is example. Tab one is the data. Tab 2 is the desired result.
    Attached Files Attached Files

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Can't see a pattern

    VBA Noob

  9. #9
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    convert single column to multiple columns

    Guess I should have explained it better. The way it is working is the macro would look at the first 35 lines of data and place in page 1, column 1; the next 35 lines in page 1, column 3; the next 35 in page 1, column 5; next 35 in page 2, column 1; next 35 in page 2, column 5....and so on. Hope this helps. Thanks

    I have attached updated file of how I want the data to look. Sheet 1 is the data. Sheet 2 is the desired result. I have highlighted the data indicating when a new column is to begin. I know I am only picking 35 rows at a time as this is the number of rows that will fit on one page at a time. It don't know of any other way to accomplish it, especially if the font and/or row width were to change (you could fit more or less rows on one page).

    Any help is appreciated.
    Attached Files Attached Files
    Last edited by maacmaac; 12-06-2007 at 04:14 PM. Reason: updated file attached.

  10. #10
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    Guess I should have explained it better. The way it is working is the macro would look at the first 35 lines of data and place in page 1, column 1; the next 35 lines in page 1, column 3; the next 35 in page 1, column 5; next 35 in page 2, column 1; next 35 in page 2, column 5....and so on. Hope this helps. Thanks

    I have attached updated file of how I want the data to look. Sheet 1 is the data. Sheet 2 is the desired result. I have highlighted the data indicating when a new column is to begin. I know I am only picking 35 rows at a time as this is the number of rows that will fit on one page at a time. It don't know of any other way to accomplish it, especially if the font and/or row width were to change (you could fit more or less rows on one page).

    Any help is appreciated.bump

  11. #11
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    Can any one help me with this one? I've been trying for a while to fix but no luck. See attached file and comments. Thanks. bump

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525
    Can you just show me an example?

    I can't open/download zipped file, can only see picture format file like jpg.

  13. #13
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    Jindon -

    I have attached the file per your request. Let me know if you can't open file or have any questions. Thanks.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    10-30-2007
    Location
    Norway
    MS-Off Ver
    MS Office 2007
    Posts
    345
    In your result sheet you need is to put a hardcoded reference to the correct cells in the data sheet. Or, have I missunderstod ? Is it more complicated ?

    I have attached an example. In Sheet3 I entered the 5 formulas highlighted in yellow, and copied down to the rest of the cells.

    It is possible to make one singel formuls that can be copied to the whole sheet, this choice depends on the ammount of source data you have. Is it to large to enter hardcoded refferences ?
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    10-30-2007
    Location
    Norway
    MS-Off Ver
    MS Office 2007
    Posts
    345
    In case you would like to know the formula for getting the right refferences automaticly, here it is:

    Please Login or Register  to view this content.
    Just copy this to every keyword cell in your result sheet.

  16. #16
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    It is too difficult to add a hard code to each cell. The amount of data I am looking at ranges from ~1800 rows of data to about ~40,000 rows of data. I have actually revised the sheet and deleted columns 2,4,6 (I can insert these back in as needed). I don't know if this makes it easier or not. Thanks.
    Last edited by maacmaac; 12-07-2007 at 12:12 PM.

  17. #17
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    Bjornar - Thanks for the formula. It works perfectly. Sorry to be a pain, but one more question. I am trying to modify the formula in two different ways:
    (1) I have deleted the 2nd and 4th columns and want to use formula for columns 1, 2, and 3 (right now it is using columns 1, 3, 5.
    (2) I also want to be able to use the formula if I want 4 columns instead of 3. In this case use columns 1, 2, 3, and 4.

    I am really struggling trying to modify formula. I have attached revised spreadsheet. I really appreciate your help. Thanks
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    10-30-2007
    Location
    Norway
    MS-Off Ver
    MS Office 2007
    Posts
    345
    =INDIRECT("data!A"&INT(((ROW()-1)*Z-2)/Y)*Y+ROW()+(COLUMN()-1)/X*35)

    I have renamed the 3 constants you need to change:
    X=1 , with your new example, now blank columns
    X=2, original formula, one space column
    X=3, if you for some reason wants 2 space columns

    Y=35 and Z=1 , If you only want 2 columns of keywords
    Y=70 and Z=2, original formula, 3 columns of keywords
    Y=105 and Z=3, if you deside to have 4 columns of keyword.

    I hope this is correct.... there is always some trail end error with these kind of formulas...

+ 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