+ Reply to Thread
Results 1 to 21 of 21

Combine multiple rows into one row

  1. #1
    Registered User
    Join Date
    06-10-2012
    Location
    Idaho USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Combine multiple rows into one row

    i have the following problem which i know is probably easy but i don't have excel experience.

    ROW ID | Listing ID | Image
    1 1 image1.jpg
    2 1 image2.jpg
    3 1 image3.jpg
    4 2 image4.jpg
    5 3 image-111.jpg
    6 3 image-thisone.jpg

    of course there are many more rows but what i would like this spreadsheet to look like when i'm done is this:

    ROW ID | Listing ID | Image
    1 1 image1.jpg, image2.jpg, image3,jpg
    2 2 image4.jpg
    3 3 image-111.jpg, image-thisone.jpg

    is this an easy thing to do in excel with functions?? or is it a script?? or something else??

    thanks.

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

    Re: Combine multiple rows into one row

    tyankee,

    Detach/open workbook ReorgData ColA_nbrs_toColD colB_Join_range_toColE - tyankee - EF837008 - SDG10.xls and run the ReorgData macro.


    If you want to use the macro on another workbook:


    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 ReorgData macro.
    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
    Registered User
    Join Date
    06-10-2012
    Location
    Idaho USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Combine multiple rows into one row

    Quote Originally Posted by stanleydgromjr View Post
    tyankee,

    Detach/open workbook ReorgData ColA_nbrs_toColD colB_Join_range_toColE - tyankee - EF837008 - SDG10.xls and run the ReorgData macro.


    If you want to use the macro on another workbook:


    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 ReorgData macro.

    thank you sooo much - you're example worked great BUT when i gave the sample data, i didn't quite give it exactly as it is. i thought i could figure out any coding to match my data - but alas i can't..

    here is the actual data:

    id ad_id picture order_no
    3421 89940 bb0e1f93-1296623850.jpg 1
    3422 89940 3bb1660a-1296623850.jpg 2
    3419 89942 4e495d4e-1296623850.jpg 1
    3420 89942 4068ad1a-1296623850.jpg 2
    2059 90222 be6cf096-1296599436.jpg 1
    2060 90222 aea22236-1296599436.jpg 2
    2061 90222 d6d71213-1296599436.jpg 3
    2062 90222 c0558ddb-1296599439.jpg 4
    2063 90222 0029f46f-1296599446.jpg 5
    2064 90222 884a34c7-1296599448.jpg 6
    1995 90230 4f7efd5b-1296599379.jpg 1
    1996 90230 9ee700f6-1296599379.jpg 2
    1997 90230 0fe35b30-1296599379.jpg 3



    the order_no field orders the pictures within the ad_id

    sorry about that - but i'm sure to an expert like yourself this is also an easy change..
    http://MustangTraderOnline.com

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

    Re: Combine multiple rows into one row

    tyankee,

    It also makes it easier for us if you would not quote the helpers reply.


    It is always best if we have the actual raw data. And, it would also help if we could see what the results should be.


    Can we have your raw data workbook, with the worksheet containing the actual raw data (sensitive data scrubbed/removed/changed), and, in the same workhseet (to the columns on the right) what the results should be.


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

  5. #5
    Registered User
    Join Date
    06-10-2012
    Location
    Idaho USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Combine multiple rows into one row

    i keep getting invalid file when i try to upload my csv - so i had to save it as tab delimeted text... i put the results for the first 2 ad_id's in the right columns..
    Attached Files Attached Files

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Combine multiple rows into one row

    is this what you want? i used excels advanced filter to extract an unique list of colb to col g
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  7. #7
    Registered User
    Join Date
    06-10-2012
    Location
    Idaho USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Combine multiple rows into one row

    No.. all of the images should be combined into one column, separated by a comma, as in my example.

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Combine multiple rows into one row

    you can add that easily enough
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    06-10-2012
    Location
    Idaho USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Combine multiple rows into one row

    looks like that worked.. thanks a million.. where could i see the coding for this?? is is embedded in a macro in the spreadsheet you sent me??

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Combine multiple rows into one row

    if you mean me ,its just a bunch of formulas click in the cells

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

    Re: Combine multiple rows into one row

    tyankee,

    Please attach an Excel workbook so that we know where your actual raw data is (cells, rows, columns).

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

  12. #12
    Registered User
    Join Date
    06-10-2012
    Location
    Idaho USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Combine multiple rows into one row

    Quote Originally Posted by martindwilson View Post
    if you mean me ,its just a bunch of formulas click in the cells
    martin, i see the formulas but the new columns must have been created with a macro??? the formulas just rearrange these new columns, don't they?

  13. #13
    Registered User
    Join Date
    06-10-2012
    Location
    Idaho USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Combine multiple rows into one row

    [QUOTE=stanleydgromjr;2819975]tyankee,

    Please attach an Excel workbook so that we know where your actual raw data is (cells, rows, columns).

    It won't let me attach a CSV file...

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

    Re: Combine multiple rows into one row

    tyankee,

    Last try.

    I am asking for an Excel workbook, not a CSV file.

  15. #15
    Registered User
    Join Date
    06-10-2012
    Location
    Idaho USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Combine multiple rows into one row

    sorry about that - dealing with a newbie here.. don't understand the difference but i've saved it as a workbook and attached it.
    Attached Files Attached Files

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

    Re: Combine multiple rows into one row

    tyankee,

    Thanks for the workbook.

    The below macro will create 218 rows in columns H:I, from the 1,106 rows of raw data in columns B:C, in 0.141 seconds on my Lenovo T61 laptop.


    Detach/open workbook ReorgData colBC colHI groups - tyankee - EF837008 - SDG10.xlsm and run the ReorgData macro.


    If you want to use the macro on another workbook:


    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 ReorgData macro.

  17. #17
    Registered User
    Join Date
    06-10-2012
    Location
    Idaho USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Combine multiple rows into one row

    Stanley, you're a guru.. thanks a whole lot..

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

    Re: Combine multiple rows into one row

    tyankee,

    You are very welcome. Glad I could help.

    Come back anytime.

  19. #19
    Registered User
    Join Date
    06-20-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Combine multiple rows into one row

    Have edited (removed) due to breaking rule 2 - sorry, should have read the rules, have done now,

    Regards

    Michael
    Last edited by MichaelWood; 06-21-2012 at 08:21 PM. Reason: Have edited due to breaking rule 2 - sorry

  20. #20
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Combine multiple rows into one row

    MichaelWood welcome to the forum. but you have already broken rule 2
    2. Don't post a question in the thread of another member -- start your own. If you feel it's particularly relevant, provide a link to the other thread.
    a mod will come and get yer .

  21. #21
    Registered User
    Join Date
    06-20-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5

    Thumbs up Re: Combine multiple rows into one row

    Quote Originally Posted by martindwilson View Post
    MichaelWood welcome to the forum. but you have already broken rule 2
    2. Don't post a question in the thread of another member -- start your own. If you feel it's particularly relevant, provide a link to the other thread.
    a mod will come and get yer .
    Thanks for the tip, will do.
    Michael

+ 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