+ Reply to Thread
Results 1 to 9 of 9

Concatenate unique entries from cells

  1. #1
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Talking Concatenate unique entries from cells

    Hello! From cells A1, A2, A5, A9, A10: concatenate the text in the cell only if the entry doesn't match the entry in any other cell.


    So, for:

    A1 My, A2 name, A5 is, A9 bob, A10 mailman

    Cell B1: =A1&char(10)&A2&char(10)&A5&char(10)&A9&char(10)&A10

    My
    name
    is
    bob
    mailman

    But if A9 = My and A10 = is, the result should be:

    My
    name
    is

    so, my formula had to take into account the permutations, and then the formula grew like crazy. (=if(a1<>A2,A1<>A5, A2<>A5, A1<>A9, A9<>a2, etc.

    Is there any easy way to do this so that the formula only concatenates the unique entries in these cells?

    Thanks!

    VR/Lost
    Last edited by leaning; 12-16-2010 at 09:43 PM. Reason: Solved!

  2. #2
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Concatenate unique entries from cells

    Hello!

    I found this:

    For a formula solution, assuming that A2:A10 contains your data, try the following...

    B1: leave empty
    B2, copied down:

    =IF(OR(COUNTIF($B$1:B1,A2:$A$10)=0),INDEX(A2:$A$10,MATCH(0,COUNTIF($B$1:B1,A2:$A$10),0)),"")
    ....confirmed with CONTROL+SHIFT+ENTER, not just ENTER
    I was just going to =A1, =A2, =A5, etc. to a new column, and then use the range formula above to extract the unique values, but it keeps putting a 0 in the list when I delete data from one of the referenced cells.

    Any ideas on how to change the formula to stop putting those zeroes in there?

    VR/Lost

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Concatenate unique entries from cells

    ConcatIf
    http://www.excelforum.com/excel-prog...in-cell.html#2 'explanation
    http://www.excelforum.com/attachment...if-example.xls 'sample
    http://www.excelforum.com/attachment...tif-sample.xls 'sample
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Concatenate unique entries from cells

    A further alternative:

    Please Login or Register  to view this content.
    called from cell (B1) along the lines of:

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Concatenate unique entries from cells

    Sirs,

    I can't see how to apply your codes. If you look at what I attached, I tried to create something which illustrates what I was looking for.

    Santa is delivering presents to the people in the yellow cells. As part of his process, he sends Christmas Card reminders (3 copies) to each of those people, and then one reminder always back to the home office at the North Pole.

    As you can see from the distribution list, since Grandma will be visited twice (he really likes Grandma), the distribution has her getting 6 reminders vice 3. That is what the code should stop.

    HTH!

    VR/Lost
    Attached Files Attached Files

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Concatenate unique entries from cells

    Please install the UDFs that DonkeyOte and I suggested and at least try to implement them in your sheet.

  7. #7
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Concatenate unique entries from cells

    JBeaucaire,

    I used your code and tried to apply it. but I can't get the CHAR(10)'s to be treated as commands rather than text.

    Your code and explanation is written pretty clear, so I don't see why it isn't working like it should for this.

    ??

    VR/Lost
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Concatenate unique entries from cells

    All,

    I got it to work!

    Thanks for the help!

    VR/Lost
    Attached Files Attached Files

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Concatenate unique entries from cells

    Good job!

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ 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