+ Reply to Thread
Results 1 to 12 of 12

Condense duplicate data to one row, data in same column in new row

  1. #1
    Registered User
    Join Date
    10-08-2009
    Location
    Chatsworth, CA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Condense duplicate data to one row, data in same column in new row

    Hi,
    I have a spreadsheet that has "Parts" in the first column and "Due Dates" in the following columns. Currently, the data is spread across rows with the same part appearing more than once with different dates in different columns.

    I would like to condense the data to a single row per part but with its dates spread across columns in the same row (and remaining in its same column position as it was originally but in the new row). Preferably with VB.


    Example below:

    Existing Worksheet (Sheet1)
    A1 A2 A3 A4
    R1 Part1 10/1
    R2 Part1 10/2
    R3 Part1 10/3
    R4 Part2 10/1
    R5 Part2 10/4

    Condensed Worksheet (Sheet2)
    A1 A2 A3 A4
    R1 Part1 10/1 10/2 10/3
    R2 Part2 10/1 10/4

    I don't know if the spacing in the example will carry into the posted message so I have attached an example spreadsheet (Excel 2007).
    Thank you,
    Chris


    New Parameters:
    Condense onto same worksheet (instead of separate worksheet).
    Attached Files Attached Files
    Last edited by resmed; 10-22-2009 at 05:19 PM. Reason: Parameters changed

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Condense duplicate data to one row, data in same column in new row

    Hi

    See how this goes.

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    10-08-2009
    Location
    Chatsworth, CA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Condense duplicate data to one row, data in same column in new row

    Thank you! That does exactly what I wanted.

    Chris

  4. #4
    Registered User
    Join Date
    10-08-2009
    Location
    Chatsworth, CA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Condense duplicate data to one row, data in same column in new row

    Thanks, Rylo.

    Something has changed - what if I want to perform the function on the same spreadsheet instead of copying the cells to a 2nd spreadsheet?

    Chris

  5. #5
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Condense duplicate data to one row, data in same column in new row

    Hi

    One way would be to create a temporary spreadsheet, use the above macro to put it to that temporary sheet, copy from the temp over the original, then remove the temporary sheet.

    Would that suffice?

    rylo

  6. #6
    Registered User
    Join Date
    10-08-2009
    Location
    Chatsworth, CA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Condense duplicate data to one row, data in same column in new row

    Yes, that would be okay.
    I would need the copied cells to be put onto an existing sheet (Sheet2) that has labeling across the first 3 rows.
    So is there a way to specify that the data be copied starting at row 4?

    Thanks again.

    Chris

  7. #7
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Condense duplicate data to one row, data in same column in new row

    Chris

    Put up an updated example file showing your real stucture, how it starts, and how it is to look when completed.

    ryl

  8. #8
    Registered User
    Join Date
    10-08-2009
    Location
    Chatsworth, CA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Condense duplicate data to one row, data in same column in new row

    Hi,
    Here is an example of the spreadsheet.

    The data is Parts (with some items such as description, cost, etc.) and Due Dates with quantity and weekday.

    Sheet "Input" has the data (brought in from an ODBC link to a database) and the various dates (with quantity and weekday) spread out across the columns based on week number.
    At this point, the spreadsheet is usable except that a single part appears on more than one row if it has more than one due date. So the only change that would need to occur is the condensing of the mentioned rows to a single row. The dates are already in the correct column, they just need to move to the first row that its related part number appears and the remaining duplicate rows of that part number deleted (after all the dates are moved to the same row).

    Sheet "Output" shows how the data should be condensed to a single row per part with the various due dates spread across the columns on the same row (note, the dates did not have to move columns, they just had to move to the first row that the part appeared).

    Rows 1-3 contain static labels. Columns 1-7 contain part number, description items such as order, customer part number, etc. These columns/rows will always contain this info. It may not always contain the same part numbers, it changes based on orders/production.

    The due dates start at column 8-63. These columns will always contain this info.

    Thank you and do let me know if you need any other info or clarification.

    Chris
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Condense duplicate data to one row, data in same column in new row

    Chris

    See how this goes for the example file.

    Please Login or Register  to view this content.
    rylo

  10. #10
    Registered User
    Join Date
    01-23-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Condense duplicate data to one row, data in same column in new row

    Hey guys, sorry for bumping this old thread but this is very close to what I need. It is as close as I have gotten to finding a solution.

    I need something like the first person asked for, except one that can handle a few more columns (preferably adjustable). For instance:

    A1 A2 A3
    R1 PART1 4 5
    R2 PART1 3 7
    R3 PART1 6 8
    R4 PART1 5 6
    R5 PART2 5 3


    Would be:


    A1 A2 A3 A4 A5 A6 A7 A8 A9
    R1 PART1 4 5 3 7 6 8 5 6
    R2 PART2 5 3


    All of the data I am using may be either numerical or a character.

    Any help would be GREATLY appreciated as I am currently using a much more manual time intensive process to achieve this. This is my first post so if I did something wrong don't hesitate to haze me.

    Thanks guys.
    Last edited by WorksheetWarrior; 01-23-2012 at 02:10 PM.

  11. #11
    Registered User
    Join Date
    08-31-2012
    Location
    china
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Condense duplicate data to one row, data in same column in new row

    Can someone past the fomular here directly without the attachment? it is not allowed to download the file in firm's PC. Thank you in advance.

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Condense duplicate data to one row, data in same column in new row

    yabin1,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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