+ Reply to Thread
Results 1 to 10 of 10

Concatenate duplicates + delete + more steps

  1. #1
    Registered User
    Join Date
    10-15-2009
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    3

    Concatenate duplicates + delete + more steps

    I have 2 columns of data with 7,000 rows that I am trying to manipulate in the following way. The first column contains a list of car manufacturers (not really my example, but involves the same concept). The second column contains a list of different models of cars. For instance,

    Ford | Taurus
    Chevrolet | Avalanche
    Saturn | Sky
    Ford | Explorer
    Honda | Accord
    Ford | Taurus

    What I want is a list of 2 columns with UNIQUE car manufacturers in first column with a list of UNIQUE car models (comma delimited) in second column. So for this example, the first row could read " Ford | Taurus,Explorer". I don't want Taurus to appear twice. I got a lot of help from JBeaucaire from this post. I just can't add the ability to remove car models from the list also. Thanks in advance for all the help!
    Last edited by davidhutchison1; 10-16-2009 at 09:42 PM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Concatenate duplicates + delete + more steps

    david
    code delete ..... I try again forgot about the dups
    Last edited by pike; 10-16-2009 at 02:04 AM. Reason: wrong code
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Concatenate duplicates + delete + more steps

    hi david
    for 7,000 rows try using a pivot table

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Concatenate duplicates + delete + more steps

    Here you go
    Please Login or Register  to view this content.
    when you dont use something for a while you forget the tricks

  5. #5
    Registered User
    Join Date
    10-15-2009
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Concatenate duplicates + delete + more steps

    Pike, this works perfectly! Can you modify the code to remove any spaces in the resulting concatenated column though? I'm talking about the preceding spaces before the first entry in each resulting cell (I could use the trim function in excel but having it in VBA would be a lot easier) as well as the spaces after each comma if there are multiple car models for each car manufacturer.

    Thanks a lot for the help!

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Concatenate duplicates + delete + more steps

    daveo
    try changing the IIF code to
    Please Login or Register  to view this content.
    The IIF script adds the spacing to and between the items

  7. #7
    Registered User
    Join Date
    10-15-2009
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Concatenate duplicates + delete + more steps

    Actually it was the space in red below that was causing all the spacing:

    Please Login or Register  to view this content.
    Once I changed it to "" it removed the spaces in the beginning on the cell and the spaces after the commas. Thanks anyways!

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Concatenate duplicates + delete + more steps

    My bad
    well done

    try..
    Please Login or Register  to view this content.
    please dont forget to change the post to solved and rate help
    Last edited by pike; 10-16-2009 at 08:35 PM. Reason: coode added

  9. #9
    Registered User
    Join Date
    04-07-2012
    Location
    australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Concatenate duplicates + delete + more steps

    Hi Pike

    I have a simliar issue and have been trying to solve it my self for 3 days but cant get anywhere with it, the id number can be different but same value 331, 0331 but all the names are the exact same.

    ID name website email Phone package cat_i
    650 Next inc www."".com aa@"".com 111 TLI10 201
    650 Next inc www."".com aa@"".com 111 AER 151
    31 NEXUS www."".com aa@"".com 222 AER 151
    031 NEXUS www."".com aa@"".com 222 AEC 425
    031 JUST CORP www."".com aa@"".com 333 TLI10 201
    15496 ACME inc www."".com aa@"".com 444 TLI10 201
    15496 ACME inc www."".com aa@"".com 444 RMS 245
    15496 ACME inc www."".com aa@"".com 444 AEC 425


    i need to run a macro to change it to

    ID name website email Phone package cat_i
    650 Next inc www."".com aa@"".com 111 TLI10, AER 201,151
    31 NEXUS www."".com aa@"".com 222 AER, AEC 151, 425
    031 JUST CORP www."".com aa@"".com 333 TLI10 201
    15496 ACME inc www."".com aa@"".com 444 TLI10, RMS, AEC 201, 245, 425

    Please help if you can i have 18000 rows and i have been manualy doing data entry and have only got 2000 rows done this will take me weeks to do
    Last edited by trent_mac; 04-07-2012 at 01:53 PM.

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Concatenate duplicates + delete + more steps

    trent, forum rules state that you cannot piggy=back onto an existing thread. Ypu need to start a new thread with your request
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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