+ Reply to Thread
Results 1 to 20 of 20

Convert cell in each column as new row for the same

  1. #1
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Talking Convert cell in each column as new row for the same

    Hello Everyone

    here I'm trying to let each cell in new column related for particular row (ID) be in new row for the same row ID , here is the example:

    A 1 0 1 1
    B 0 0 0 1
    C 1 0 1 0
    D 0 1 1 1

    The required results:

    A 1
    A 0
    A 1
    A 1
    B 0
    B 0
    B 0
    B 1
    C 1
    C 0
    C 1
    C 0
    D 0
    D 1
    D 1
    D 1

    The excel sheet is huge, it has more the 100 row and almost 8000 columns

    How can I do that !

    Thanks in advance
    Last edited by blask; 10-17-2018 at 05:36 AM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Convert cell in each column as new raw for the same

    The word is ROW not raw.

    VBA or formula solution?
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Re: Convert cell in each column as new raw for the same

    Thanks, I edited the word "row"

    The formula solution is better for me,

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Convert cell in each column as new row for the same

    VBA solution is probably easier, as it's not clear if all rows contain the same number of columns or not.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Re: Convert cell in each column as new row for the same

    I will try it
    Last edited by blask; 10-17-2018 at 02:27 PM.

  6. #6
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Re: Convert cell in each column as new row for the same

    It works fine now for this toy example, I will try the VBA to large excel.

    Thank you Special -K for help and quick replay

  7. #7
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Re: Convert cell in each column as new row for the same

    Please I need to add col number beside, for example:

    A 1 0 1 1
    B 0 0 0 1
    C 1 0 1 0
    D 0 1 1 1

    The result:

    A 1 col1
    A 0 col2
    A 1 col3
    A 1 col4
    B 0 col1
    B 0 col2
    B 0 col3
    B 1 col4
    C 1 col1
    C 0 col2
    C 1 col3
    C 0 col4
    D 0 col1
    D 1 col2
    D 1 col3
    D 1 col4

    What i need to add to the previous VBA to do so, instead can I add any word rather than "col",


    Cheers

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,996

    Re: Convert cell in each column as new row for the same

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please don't attach a picture of an Excel sheet (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  9. #9
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Re: Convert cell in each column as new row for the same

    Okay, I uploaded a toy example as excel sheet

    Thanks
    Attached Files Attached Files

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,996

    Re: Convert cell in each column as new row for the same

    I had hoped that by putting it in bold and red... that you would have noticed Point 2 in my post... and acted on it. So this is a bit of a guess.

    A7:
    =IFERROR(INDEX($A$1:$A$3,MATCH(0,INDEX(--(COUNTIF($A$6:A6,$A$1:$A$3)=4),0),0)),"")

    B7:
    =IFERROR(INDEX($B$1:$E$3,1+INT((ROWS($1:1)-1)/4),1+MOD((ROWS($1:1)-1),4)),"")

    C7:
    =IF(A7="","","Column "&1+MOD((ROWS($1:1)-1),4))
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Re: Convert cell in each column as new row for the same

    Thanks Glenn

    it solves this issue by formula, how can modified the VBA code to do same task !
    Please Login or Register  to view this content.
    Cheers
    Last edited by AliGW; 10-18-2018 at 06:32 AM. Reason: Code tags added.

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,996

    Re: Convert cell in each column as new row for the same

    No idea. I don't do VBA. Didn't you state a preference for a formula??
    You're welcome.



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

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  13. #13
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Convert cell in each column as new row for the same

    Quote Originally Posted by blask View Post
    Please I need to add col number beside, for example:

    A 1 0 1 1
    B 0 0 0 1
    C 1 0 1 0
    D 0 1 1 1

    The result:

    A 1 col1
    A 0 col2
    A 1 col3
    A 1 col4
    B 0 col1
    B 0 col2
    B 0 col3
    B 1 col4
    C 1 col1
    C 0 col2
    C 1 col3
    C 0 col4
    D 0 col1
    D 1 col2
    D 1 col3
    D 1 col4

    What i need to add to the previous VBA to do so, instead can I add any word rather than "col",


    Cheers
    Change this part of my code so it looks like this

    Please Login or Register  to view this content.
    Last edited by Special-K; 10-18-2018 at 05:42 AM.

  14. #14
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Re: Convert cell in each column as new row for the same

    Yes it works perfectly

    Many Thanks Special-K

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,609

    Re: Convert cell in each column as new row for the same

    Please note for future reference that you are required to enclose code within code tags - I have done it for you this time, but expect you to do it yourself another time. Thanks!
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  16. #16
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Re: Convert cell in each column as new row for the same

    Appreciate that AliGW,

    Cheers

  17. #17
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Re: Convert cell in each column as new row for the same

    Last modification Special-K for this excel macro, I want to delete the row that have "0" in column 2, and keep otherwise

    Please Login or Register  to view this content.
    what to add to the macro to do that,

    Cheers

  18. #18
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Convert cell in each column as new row for the same

    Untested but try this (I'm no VBA expert).


    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    10-17-2018
    Location
    Australia
    MS-Off Ver
    2011
    Posts
    11

    Re: Convert cell in each column as new row for the same

    You are expert man, it works perfectly

    Thanks for your help and your patience

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,609

    Re: Convert cell in each column as new row for the same

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

+ 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. [SOLVED] check each cell in a column and convert to text
    By gauti14 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-22-2017, 04:29 PM
  2. [SOLVED] Row() Column() convert as Cell Reference in Formula
    By Dahlia in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-30-2013, 06:28 AM
  3. [SOLVED] How to convert a column number into another column cell
    By ahmedo047 in forum Excel General
    Replies: 12
    Last Post: 12-27-2013, 05:58 AM
  4. Need to convert cell values to column headings
    By faizaan316 in forum Excel General
    Replies: 1
    Last Post: 05-02-2013, 01:03 PM
  5. How to convert (calculated) zero to blank cell in column
    By canada123 in forum Excel General
    Replies: 4
    Last Post: 11-16-2011, 02:50 PM
  6. How to convert a column's cell formats
    By Stretch617 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-10-2008, 02:28 PM
  7. convert a column into one cell
    By mrbrown07 in forum Excel General
    Replies: 1
    Last Post: 07-28-2007, 03:26 AM

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