+ Reply to Thread
Results 1 to 6 of 6

Check for duplicates against multiple criteria and then concatenate values

  1. #1
    Registered User
    Join Date
    05-12-2016
    Location
    NZ
    MS-Off Ver
    Office 14
    Posts
    41

    Check for duplicates against multiple criteria and then concatenate values

    Hi there,

    Hope this is in the right place - I've used this forum a lot to learn macro programming, but now I'm struggling with an element in a larger macro I'm writing.

    For this section, I need to check for duplicates against multiple columns, and then, for duplicates, concatenate the values in one column into the cell of the row that is being kept. That might not make sense so here's an example:

    Column A..........Column B..........Column C
    Pen..................Blue..................Ballpoint
    Pen..................Blue..................Fountain
    Pen..................Red...................Ballpoint
    Stapler.............Blue..................Desktop
    Stapler.............Blue...................Heavy-Duty

    I only want it to be considered a duplicate if both Columns A and B are the same, and then, if they are, I want to put the values in column C into one cell and then delete the duplicates - so my outcome should be:

    Column A..........Column B..........Column C
    Pen...................Blue.................Ballpoint, Fountain
    Pen...................Red..................Ballpoint
    Stapler..............Blue.................Desktop, Heavy Duty

    I know how to check for duplicates against one column, but not multiple, and I'm also struggling with the syntax of how to concatenate the values, so basically I have nothing..

    Could anyone give me some pointers?
    Anything you can give me would be fantastic

    Thanks,
    Last edited by Pango; 05-15-2016 at 06:02 PM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Check for duplicates against multiple criteria and then concatenate values

    Try
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-12-2016
    Location
    NZ
    MS-Off Ver
    Office 14
    Posts
    41

    Re: Check for duplicates against multiple criteria and then concatenate values

    Gosh, that's phenomenal! Thank you so so much - it works perfectly first time and is exactly what I needed!

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Check for duplicates against multiple criteria and then concatenate values

    You are welcome.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  5. #5
    Registered User
    Join Date
    05-12-2016
    Location
    NZ
    MS-Off Ver
    Office 14
    Posts
    41

    Re: Check for duplicates against multiple criteria and then concatenate values

    No obligation to respond, you've already done more than I could have expected! Just trying to learn from your response - could you tell me what this section of your code is doing?

    For ii = 1 To UBound(a, 2)
    a(.Count, ii) = a(i, ii)

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Check for duplicates against multiple criteria and then concatenate values

    It is replacing row of elements for the unique data within an array in order of appearance.

+ 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. [SOLVED] HELP: Vlookup using multiple criteria to check values
    By jasonj427 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-15-2014, 09:00 PM
  2. [SOLVED] Macro to find duplicates, concatenate Unique Values, then delete old duplicates
    By lesoies in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-17-2013, 04:32 PM
  3. Update to Macro to find duplicates, concatenate Unique Values
    By lesoies in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-10-2013, 06:35 PM
  4. Replies: 3
    Last Post: 05-23-2013, 07:50 PM
  5. Lookup/ Return and concatenate values based upon multiple criteria
    By steveboise in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-15-2013, 10:43 AM
  6. Select multiple criteria based on check box selection and return all unique values.
    By TommyToe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2013, 09:14 AM
  7. Concatenate values from columns and deleting duplicates
    By RandomP in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-15-2011, 06:20 PM
  8. Macro to remove duplicates values and keep unique values bases on multiple criteria
    By Ricker090 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2011, 04:37 PM

Tags for this Thread

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