+ Reply to Thread
Results 1 to 23 of 23

Help! Need to move data from one cell in one row into several rows - & copy rest of row

  1. #1
    Registered User
    Join Date
    03-02-2013
    Location
    Dublin
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    13

    Help! Need to move data from one cell in one row into several rows - & copy rest of row

    Hi,

    I've registered in this forum because I'm looking for help with a specific Excel issue. I publish a green building mag, and we run an enquiry system for readers on our website. This is the link: http://passivehouseplus.ie/form/1-enquiries

    As you can see, the idea is that readers tell us some info about themselves, including what types of products/services they'd like to receive information about, and we pass their details on to advertisers offering those products/services.

    When someone fills out a form, we get data in Excel on their enquiry. It's all in one row - name, contact details, and then the products/services they've enquired about are included in one cell, separated by commas.
    So for instance, suppose a listing currently came in as follows (column headings in brackets:

    (name) Joe Soap / (job title) Architect / (organisation) Joe Soap Architecture / (address) 123 Soap St, Soapville / (enquiries) insulation, solar panels, windows

    Essentially I want it to run like this:
    (name) Joe Soap / (job title) Architect / (organisation) Joe Soap Architecture / (address) 123 Soap St, Soapville / (enquiries) insulation
    (name) Joe Soap / (job title) Architect / (organisation) Joe Soap Architecture / (address) 123 Soap St, Soapville / (enquiries) solar panels
    (name) Joe Soap / (job title) Architect / (organisation) Joe Soap Architecture / (address) 123 Soap St, Soapville / (enquiries) windows

    Anyone know any way of automating this?

    I'd really appreciate any help. We're a small business looking to make a positive contribution to the world.

    Cheers,

    Jeff
    --

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    jeffphplus,

    Welcome to the Excel Forum.

    Nice web site.

    When you have the raw data in a workbook/worksheet:
    1. is the following information in one cell A1?
    (name) Joe Soap / (job title) Architect / (organisation) Joe Soap Architecture / (address) 123 Soap St, Soapville / (enquiries) insulation, solar panels, windows

    2. is there any other additional information after/past to the right of?
    / (enquiries) insulation, solar panels, windows..............

    3. is there similar data in the next cell, A2?
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    jeffphplus,

    If there is NO additional information after/past to the right of:
    / (enquiries) insulation, solar panels, windows

    And, your raw data is in worksheet Sheet1, column A, beginning in cell A1 down, then:

    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    1. Copy the below code, by highlighting the code and 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. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. 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.

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgEnquiries macro.

  4. #4
    Registered User
    Join Date
    03-02-2013
    Location
    Dublin
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    13

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Thanks so much. I'll try those suggestions and let you know how I get on.

  5. #5
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    jeffphplus,

    If the macro does not work correctly, then I will have to see your workbook.

    To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.

  6. #6
    Registered User
    Join Date
    03-04-2013
    Location
    Dublin
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Hi Stanley,

    I'm the original posters brother. We tried the above but to no avail, so if you wouldn't mind I've attached a sample workbook.

    The first three entries are how the data is presented to us by RSForm.
    From row 10 is how we want it to look, with all the entries in the categories field extrapolated from one cell into multiple cells, duplicating the rest of the row each time. This will then allow us to sort all users by category, eg, 'all users who chose Thermal Blocks'.

    We then need to create new worksheets for each category, but thats a challenge for another day!

    Thank you very much in advance for any help you can give.
    Dudley
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    jeffphplus, the corpo,

    Thanks for the workbook containing the raw data and the results.

    In the future when asking for help, please include a workbook with before and after worksheets.

    With your raw data in the first worksheet, the left-most-worksheet in the tabs view.

    The below macro will create a new worksheet Results, containing the results your are looking for.

    And, the below macro is very fast because of the use of arrays in memory.


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    1. Copy the below code, by highlighting the code and 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. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. 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.

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgCategories macro.

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

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    This should do the job.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-04-2013
    Location
    Dublin
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Thanks so much, Stanley, that worked perfectly! You've saved me *many* hours of cutting and pasting misery!

    Would it then be possible to run a similar macro to create seperate sheets with all the results from each category?
    i.e. A sheet for everyone who chose airtightness, a sheet for everyone who chose Combined Heat and Power

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

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    ................
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    jeffphplus, the corpo,

    It looks like jindon has done it again - he has shortened the strings and removed certain characters that can not be used in a worksheet name. Nicely done, but, the macro code is password protected.


    Based on your last request.

    When worksheet Results is created, column O, contains the strings to create the new worksheet names.

    Most of the strings are longer than 31 characters. Excel will not allow a worksheet name to be longer that 31 characters.

    1. Will I be able to use the first 31 characters to create the new worksheet names?

    2. Are there any strings for column O, Categories, where there could be duplicates for the first 31 characters, for each unique Name in column B?

    3. If so, can you supply a list of all column O Categories?
    Last edited by stanleydgromjr; 03-05-2013 at 12:51 PM.

  12. #12
    Registered User
    Join Date
    03-04-2013
    Location
    Dublin
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Hi again guys,

    I overlooked another trick we need to get done in that original sheet at the same time as the fix asked for. Is it possible to run two macros at the same time?

    There is a column called ProjectImperatives and like the Categories column it returns multiple answers from a choice of 8 in a single cell.
    We need a new colum for each of those choices stating "Yes" or "No" depending on whether the data is in that cell.

    So, in the new sheet we need the ProjectImperatives column to go, and be replaced by the following 8:

    Certified passive
    Indoor air quality
    Low running costs
    Low allergy & healthy building
    Low environmental impact
    Natural building
    Near passive/low energy
    Other (please state)

    I've attached a sample again, with the before in one sheet and the after in another, as requested.

    In advance, thank you hugely if you can help!
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    03-02-2013
    Location
    Dublin
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    13

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Stan, Jindon,

    Thanks so much for your thoughts so far. You've been really helpful. Any help with this other issue would be amazing.

    If you ever need to pick my brains on advice regarding energy efficient building and upgrading just DM me.

    Cheers,

    Jeff

  14. #14
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    jeffphplus,

    You are very welcome. Glad we could help.

    Thanks for the feedback. And, come back anytime.

  15. #15
    Registered User
    Join Date
    03-02-2013
    Location
    Dublin
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    13

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Hi Stan,

    Apologies - I gather it was your suggestions that worked. So credit where it's due - thanks! I've been up the walls busy, and I didn't take the time to deal with this.
    Thanks to jindon too for trying to help.

  16. #16
    Registered User
    Join Date
    03-02-2013
    Location
    Dublin
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    13

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Stan,

    If it's not terribly cheeky, do you have any ideas on how to resolve the problem raised by the corpo above? I spent hours the other night manually moving that info into different columns. The problem was complicated by the fact that there's hidden line breaks in the project imperatives column (column N), and when I tried to follow the typical instructions on how to remove those breaks (including the Alt 0010 command) I struggled to get it to work.

    Any ideas would be greatly appreciated.

    I should say that we'll happily set you up with a free digital subscription to the mag if it interests you - or a friend.

    Thanks,

    Jeff

  17. #17
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    jeffphplus,

    Thanks for the confidence. But, the code I posted does not deal with the problem of special characters in a worksheet name.

    jindon's code took care of the above.

    I would suggest that you send jindon a Private Message, with a link to your/this Post, and, I am sure that he will help you again.

  18. #18
    Registered User
    Join Date
    03-04-2013
    Location
    Dublin
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Thanks Stanley, will do that.

    Jindon, to try and make things as straightforward as possible, here's our request all in one on post, hope it makes some sense!


    Step 1:

    There is a column called ProjectImperatives and like the Categories column it returns multiple answers from a choice of 8 in a single cell.
    We need a new colum for each of those choices stating "Yes" or "No" depending on whether the data is in that cell.

    So, in the new sheet we need the ProjectImperatives column to go, and be replaced by the following 8:

    Certified passive
    Indoor air quality
    Low running costs
    Low allergy & healthy building
    Low environmental impact
    Natural building
    Near passive/low energy
    Other (please state)


    Step 2:

    The original request, where the data from the categories is extracted and duplicates the row for every instance of that data. When I run jindon's code nothing happens, that I can see.


    Step 3:
    This would just be a handy bonus, as manually doing it isn't that time consuming, but still it would be nice! We would like a new worksheet created for each category.
    So a Solar thermal sheet, a Heat pumps sheet etc.
    If this complicates the above two steps then it doesn't matter at all!

    Thanks again for all the help.
    Attached Files Attached Files

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

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Quote Originally Posted by the corpo View Post
    Step 2:

    The original request, where the data from the categories is extracted and duplicates the row for every instance of that data. When I run jindon's code nothing happens, that I can see.
    If you tried the file in my post #8 and it does nothing then I can not help you more.
    You should ask somebody else.

  20. #20
    Registered User
    Join Date
    03-04-2013
    Location
    Dublin
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Hi Jindon, thanks for getting back to us.

    When I run the macro using the same steps Stanley suggested:

    1. Copy the below code, by highlighting the code and 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. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. 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.

    the worksheet loses most of the data and bolds what is left. Should I run it differently, and does it matter what version of Excel I'm using?

  21. #21
    Registered User
    Join Date
    03-29-2013
    Location
    Delmar, MD
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Hello,

    I have a similar problem to the original post. Mine is a little different though, I'm trying to take 1 row with multiple column info and create multiple rows showing the info in 1 column. Hard to explain, here is an example. Please let me know if you can help, thank you!Capture.JPG

  22. #22
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    ave320,

    Welcome to the Excel Forum.

    Your data structure, and results, are different.

    Please do not post your questions in threads started by others - - this is known as thread hijacking.
    Always start a new thread for your questions and, if you think it helps, provide a link to any other thread as a reference.
    Start a new thread for your question and be sure to give it a search friendly title that accurately describes your need.

    Please start your own New Post, with a descriptive/informative title, and, then send me a Private Message with a link to you new post, and to this post, and, I will have a look.

    In your New Post, instead of posting a graphic/picture try the following:

    To get the most precise answer, it is best to upload/attach a sample workbook (sensitive data scrubbed/removed/changed) that contains an example of your raw data on one worksheet, and on another worksheet your desired results.

    The structure and data types of the sample workbook must exactly duplicate the real workbook. Include a clear and explicit explanation of your requirements.

    To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.

  23. #23
    Registered User
    Join Date
    03-04-2013
    Location
    Dublin
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Hi again Jindon,
    Apologies, I was doing it wrong! Working perfectly now.

    Could either of you possibly look at that second request, to expand the ProjectImperatives category?

    Thanks again!

  24. #24
    Registered User
    Join Date
    03-04-2013
    Location
    Dublin
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Help! Need to move data from one cell in one row into several rows - & copy rest of ro

    Hi again guys,

    Been using both bits of code very successfully for months now, which has been brilliant, but I've changed the workbook slightly, and haven't been able to adapt the code accordingly. I've tried!

    All I've done is add some extra columns before the column which your macro had been running on (what was 'name' is now 'first name', 'last name' etc,). It was column 15, now it is 19. Thought I could get away with just changing that value, but it's not working.

    Is there any chance you could have a look at the macro again for us?? Thanks in advance....Enquiries.csv

+ 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