+ Reply to Thread
Results 1 to 15 of 15

Combining rows of data, only if unique

  1. #1
    Registered User
    Join Date
    08-15-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Office 2016
    Posts
    15

    Question Combining rows of data, only if unique

    I have data that I have extracted from another program and would like to condense the rows of data in Exce; but not sure which formulas to use to do so. Below is an example of what the data originally looks like, and what I would like it to be condensed to once complete.

    Can anyone offer some thoughts on the steps to take to condense the data?

    ORIGINAL:
    A B C D
    1,000 Corporate Center UT LINKS (NW4)
    1,000 Corporate Center GR LINKS (NW4)
    1,000 Corporate Center PB LINKS (NW4)
    1,000 Corporate Center BE LINKS (NW4)
    1,000 Neighborhood UT LINKS (NW4)
    1,000 Neighborhood DEN LINKS (NW4)
    1,000 Neighborhood PB LINKS (NW4)

    REVISED:
    A B C D
    1,000 Corporate Center, Neighborhood UT, GR, OB, BE, UT, DEN LINKS (NW4)


    I need the revised row to compile only the unique values from the original dataset

    Any advice or direction would be very helpful.

    Thanks!
    Last edited by futbolfan; 05-29-2014 at 04:01 PM. Reason: Clarification

  2. #2
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Combining rows of data, only if unique

    You can use this formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    . Then, copy and paste as values, use the "remove duplicates tool", and copy and paste transposed.

  3. #3
    Registered User
    Join Date
    08-15-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Office 2016
    Posts
    15

    Question Re: Combining rows of data, only if unique

    Quote Originally Posted by k64 View Post
    You can use this formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    . Then, copy and paste as values, use the "remove duplicates tool", and copy and paste transposed.
    Thanks for the reply.

    I pasted the formula at the end of the row in Column G and copied it down and then removed the duplicates.
    However I have about 250+ rows of data and when I paste and transpose its a long list across the columns.
    As well I need the values from column D and column E grouped into one cell, if that is possible.

    I have attached a sample workbook.

    Rows 2 to 6 are associated with LINK 1. I want all of the information displayed in one row.

    Ex,
    LINK 1 ME9 Meadowtown CN, Huronia NHD, Rathwood NHD HD, G, MD, OS


    Is it possible to collapse the rows of data that only the unique information remains?

    Thanks!
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Combining rows of data, only if unique

    Is this what you want?
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-15-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Combining rows of data, only if unique

    Quote Originally Posted by k64 View Post
    Is this what you want?
    Not exactly.

    I have attached another workbook and the columns to the right in row 2 and row 68 I have shown how I want the fields collapsed.

    I should mention CENT is the main column. LINK1 shows up 5 times, but in the final version I want it all collapsed into one row and only the unique data to appear in the final output.

    Thanks!
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Combining rows of data, only if unique

    Well, it took me a while to get this to work, but I think I finally have it.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-15-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Combining rows of data, only if unique

    Quote Originally Posted by k64 View Post
    Well, it took me a while to get this to work, but I think I finally have it.

    Thank you for your help with this.

    The one thing I caught is that there are duplicates in the DESIG field - but I can manually edit that if I have to.

    I see that you built a macro, how easy is it to move from one spreadsheet to another and do I have to ensure that the document is always set-up in this manner?

  8. #8
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Combining rows of data, only if unique

    You're welcome
    I'm not sure what you mean about duplicates in the DESIG field. For different CENT numbers, there are duplicates, but I thought that is what you wanted. For each CENT "group" I have all the AREAs and DESIGs without any duplicates.

    It is really easy to move to another spreadsheet. You simply need to copy my macro, insert a new module on the new spreadsheet, and paste my macro in. Yes, you'll need to have the same set-up, including my helper column in A, or you'll need to edit my macro for a different setup.

  9. #9
    Registered User
    Join Date
    08-15-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Combining rows of data, only if unique

    If you look at the last entry:

    LINK9 HO6 137332 Uptown MN, Huronia NHD G, HD, PBW, G, HD, LDII, PBW

    G, PBW and HD are repeated, I need those to only appear once, similar to how the AREA appears only once, sorry if that wasnt clear in my initial post.

  10. #10
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Combining rows of data, only if unique

    That's interesting. It only happens for the last row. I'll have to check why my code is doing that and get back to you.

  11. #11
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Combining rows of data, only if unique

    Found the problem. This should be better.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    08-15-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Combining rows of data, only if unique

    Quote Originally Posted by k64 View Post
    Found the problem. This should be better.
    Thank you, that was better.

    I realized one of my datasets had a few different columns, but I tried to set up the document in the same way and the macro does everything except group the items on the same line, per the attached.
    I tried to look through the macro code and figure it out, but that is above and beyond my capabilities.
    Is it possible to adjust the macro for this dataset?
    Attached Files Attached Files

  13. #13
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Combining rows of data, only if unique

    It seems to work for me. I added some comments to my code. I'm basically looping through the cells in column B and if I find a new value, I record the row number, remove duplicates between this number and the last time column B changed, and then loop through whatever is left, adding each value into one cell.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    08-15-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Office 2016
    Posts
    15

    Re: Combining rows of data, only if unique

    Sorry for the delay in responding. When I sorted the first column from smallest to largest and then run the macro it worked for me, otherwise it was crashing. Thanks very much for the help!

  15. #15
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Combining rows of data, only if unique

    The first column should be the formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in A2, dragged down.
    1. Include a sample workbook with an example of the result you want
    2. Use [CODE] and [FORMULA] wrappers for your VBA code or excel formulas
    3. If your question has been answered, mark the thread as SOLVED and click on the "Add Rep" star to thank whoever helped you.

+ 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. Combining Text from multiple Rows based on Unique ID
    By lee2k60 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2013, 12:11 AM
  2. [SOLVED] Combining a unique rows copier with a keyword search program
    By macronewbie9981 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 07-09-2013, 11:32 AM
  3. [SOLVED] Combining rows with both unique and duplicate data
    By CNFlora in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-22-2013, 05:09 PM
  4. Replies: 2
    Last Post: 06-22-2011, 06:50 PM
  5. [SOLVED] Removing duplicate rows and combining unique data
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2006, 07:10 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