+ Reply to Thread
Results 1 to 6 of 6

Remove Duplicates from Range

  1. #1
    Forum Contributor
    Join Date
    05-24-2014
    MS-Off Ver
    Microsoft Office 2013
    Posts
    113

    Remove Duplicates from Range

    I am looking for a way to remove duplicates from a specific range. I have read about the .RemoveDuplicates function in VBA but it doesn't seem to be what I need. In one row I may have a cells that include the following:
    CHICKEN,SOUP,DOG,LOVER,SOUL,DRY,DOG,FOOD,ADULT,DOG
    I would like this macro to clear cell contents of any duplicate values so that there is only one. The desired output of this example would be:
    CHICKEN,SOUP,DOG,LOVER,SOUL,DRY,FOOD,ADULT
    For simplicity's sake lets say that these cells are A1:J1

    I will have this formula loop through thousands of ranges and I can customize that but for now all I need is to know how to remove duplicates within rows without deleting entire rows or columns, just clearing cell contents of duplicates.

    Thanks!
    Last edited by manofcheese; 08-17-2015 at 06:17 PM.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Remove Duplicates from Range

    Maybe:

    Please Login or Register  to view this content.
    Clears the duplicate contents.

    Or deletes and shifts

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    05-24-2014
    MS-Off Ver
    Microsoft Office 2013
    Posts
    113

    Re: Remove Duplicates from Range

    Thanks. It worked like a charm.

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    4,860

    Re: Remove Duplicates from Range

    Perhaps try, assuming "," is the separator
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    7,469

    Cool Hi ! Try this ‼


    Another way with a single loop and MATCH Excel function :

    PHP Code: 
    Sub Demo()
        
    With [A1:J1]
            
    VA = .Value
            ReDim ND
    $(1 To UBound(VA2)):  ND(1) = VA(11):  L& = 1
        
            
    For C& = 2 To UBound(VA2)
                If 
    IsError(Application.Match(VA(1C), ND0)) Then L 1ND(L) = VA(1C)
            
    Next
            
            
    .Value ND
        End With
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon Add Reputation !

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Remove Duplicates from Range

    You're welcome. Glad to help out and thanks for the feedback.

+ 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. Remove duplicates with variable range
    By markDuffy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2015, 03:46 PM
  2. Button to Select Range remove duplicates then paste result.
    By gtbear in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2014, 08:25 AM
  3. Can't remove duplicates from range
    By medwatt in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-04-2014, 11:06 PM
  4. [SOLVED] Remove Duplicates and Spaces within a Range in a Row
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-27-2014, 01:33 PM
  5. Range in Remove duplicates
    By nsv in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2012, 05:33 AM
  6. Replies: 5
    Last Post: 07-25-2011, 09:42 PM
  7. Remove Duplicates in a Dynamic Range using Excel 2007
    By nsorden in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-22-2009, 10:24 AM

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