+ Reply to Thread
Results 1 to 11 of 11

Concatenate non-adjacent cells without duplicates

  1. #1
    Registered User
    Join Date
    11-16-2009
    Location
    United States
    MS-Off Ver
    Excel 2004
    Posts
    24

    Unhappy Concatenate non-adjacent cells without duplicates

    Hello all,

    I've been working on a spreadsheet that is used to track the application process of numerous clients. In doing this, I have a row at the top of each client that is used as a sumarry column. Below each cell in the top row, I have up to 30 non-adjacent cells that I'm trying to concatenate in the top cell separated by new lines. I'm also wanting to not display any duplicates, as there are up to only 5 steps that could be shown for each record. I found a UDF that will search an array and return only the unique values, but it accepts the data as an array, and it returns it as an array also. I seem to be having trouble passing the array from the sheet as well as formatting and returning the array with line breaks.

    In the worksheet cell:

    Please Login or Register  to view this content.

    The function ( I did not write this)

    Please Login or Register  to view this content.
    I've played with this numerous ways but these are the codes that might best describe what I'm trying to do. Really hoping some of you have some ideas for me that don't involve going bald at the age of 26 thanks!


    BTW, I'm using Excel2004 on a mac, and I need to try and keep this compatible also with Excel 2007 as that is the version the person I'm working with uses and he also needs access to this sheet.
    Last edited by turningitred; 11-17-2009 at 08:28 PM.

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

    Re: Concatenation of non-adjacent cells without displaying duplicates

    Perhaps a different UDF would work for you. Can you post up a sample sheet clearly demonstrating sample data and sample desired results. I have a couple in mind, but a sample sheet would make it clear which to use.

    Click GO ADVANCED and use the paperclip icon to post up your workbook.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    11-16-2009
    Location
    United States
    MS-Off Ver
    Excel 2004
    Posts
    24

    Re: Concatenation of non-adjacent cells without displaying duplicates

    Here is the workbook. I've highlighted the desired result for one column in yellow. The data that it should be affected by is in green. This would be a function used in most of the columns of this sheet. Thanks in advance for your thoughts here!
    Attached Files Attached Files

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

    Re: Concatenation of non-adjacent cells without displaying duplicates

    Use the CONCATIF() UDF that you have installed. It's used like a SUMIF().

    I used this in H4:

    =CONCATIF($D$5:$D$300, "<>"&"", H$5:H$300, CHAR(10), TRUE)

  5. #5
    Registered User
    Join Date
    11-16-2009
    Location
    United States
    MS-Off Ver
    Excel 2004
    Posts
    24

    Re: Concatenation of non-adjacent cells without displaying duplicates

    Wow thank you! I had looked at that function and being that I'm not terribly advanced when it comes to VBA I got really confused. But I do have a couple more questions for you with this..

    First of all, I want to include a vbNewLine in between each element..

    Would this need to go in this statement?

    Please Login or Register  to view this content.
    How would I do that. Also, how can I ensure that I don't end up with an extra newline at the end of the statements?

    I also want to ask just to make sure I understand this correctly, the range for the D column that you used, is this to only pull the values from the rows where the cell is not equal to ""? If this is the case, could it be modified to only pull where the cell IS equal to "DEL". I ask this because the blank lines between may be used to notes.

    Thank you again for this!


    I may have answered my own question with

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-16-2009
    Location
    United States
    MS-Off Ver
    Excel 2004
    Posts
    24

    Re: Concatenation of non-adjacent cells without displaying duplicates

    Nevermind haha! I got it! replaced "" in the call to "DEL" and changed CHAR(10) to brk which I set as a cell to the right that checks the system (mac vs win) and returns Char(10) and Char(13) respectively. Thank you so much for your help! Not really sure how I mark this as SOLVED in the forum, or if an Op does that, but it be solved!

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Concatenation of non-adjacent cells without displaying duplicates

    You might want to try CHAR(10)&CHAR(13) rather than probing the type of Operator.

    The CHAR(10) is invisible on my Mac. Is the CHAR(13) invisible on a PC?

    (I'm glad the UDF worked for you.)
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Concatenate non-adjacent cells without duplicates

    Not really sure how I mark this as SOLVED in the forum,
    For that and other useful information, please see the forum rules
    Entia non sunt multiplicanda sine necessitate

  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: Concatenation of non-adjacent cells without displaying duplicates

    Quote Originally Posted by mikerickson View Post
    (I'm glad the UDF worked for you.)
    Mike, your UDF is at the top of my toolbelt. Thanks again for that!

    And see, I remembered the syntax you helped me with last week on this thread. I is a'learnin!

  10. #10
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Concatenation of non-adjacent cells without displaying duplicates

    One nice thing is that the criteria syntax carries over to SUMIF,COUNTIF, data base functions (e.g. DSUM) and Advanced Filter.

  11. #11
    Registered User
    Join Date
    10-20-2009
    Location
    Coimbra, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Concatenate non-adjacent cells without duplicates

    Great thread!

+ 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