+ Reply to Thread
Results 1 to 5 of 5

Remove Duplicate Pairs(2 Columns) - Excel 2013

Hybrid View

  1. #1
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Arrow Remove Duplicate Pairs(2 Columns) - Excel 2013

    I found a similar post to mine on this forum from back in 2006. It offered a VBA macro to do this, which did not work for me for some reason. I was wondering if there is a new easy way to do this. I'm using excel 2013. I have a value in 2 columns and all I need to do is remove the corresponding UNIQUE values.

    For example (123,123) REMOVE, (123,124) Leave.

    I tried removing duplicates feature and the filter feature. But this does not work. Remove duplicates only works for duplicates in the same column. But I need to remove duplicates corresponding to unique values in both columns.

    More Example Data:

    123 123 --- REMOVE
    124 128
    126 124 --- REMOVE this 124 and matching 124, leave 126
    130 140

    When Process Finished:


    128
    126
    130 140
    Last edited by TheProffesional; 04-14-2014 at 12:16 PM.

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Remove Duplicate Pairs(2 Columns) - Excel 2013

    So after the process is complete, the above would look as follows?

    123

    124 128

    126

    130 140
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Remove Duplicate Pairs(2 Columns) - Excel 2013

    Quote Originally Posted by natefarm View Post
    So after the process is complete, the above would look as follows?

    123

    124 128

    126

    130 140
    It would look as follows:



    128

    126

    130 140

  4. #4
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Remove Duplicate Pairs(2 Columns) - Excel 2013

    The following searches columns A:B. Adjust as needed:

    Sub DeleteDups()
    Dim cel As Range, EndRw As Long, FindThis As String, FoundAt As String, IsDup As Boolean
    
        EndRw = Range("A" & Rows.Count).End(xlUp).Row
        For Each cel In Range(Range("A1"), Range("B" & EndRw))
            FindThis = cel.Value
            If FindThis <> "" Then
                IsDup = False
                Do Until FoundAt = cel.Address
                    FoundAt = Columns("A:B").Find(what:=FindThis, after:=cel, lookat:=xlWhole).Address
                    If FoundAt <> cel.Address Then
                        IsDup = True
                    End If
                    If IsDup Then
                        Range(FoundAt).ClearContents
                    End If
                Loop
            End If
        Next
    
        Do Until EndRw = 0 ' Delete resulting blank rows
            If Range("A" & EndRw).Value & Range("B" & EndRw).Value = "" Then
                Rows(EndRw).Delete
            End If
            EndRw = EndRw - 1
        Loop
    End Sub

  5. #5
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Remove Duplicate Pairs(2 Columns) - Excel 2013

    Wow, Worked Magic. Thanks a lot.

+ 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] Remove duplicate rows by matching values across columns in Excel 2007
    By guest2013 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-15-2013, 12:00 AM
  2. excel macro to remove specific columns and rows + remove duplicate
    By garrywelson in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-17-2013, 12:03 PM
  3. [SOLVED] How to remove duplicate rows only if columns A and B are BOTH duplicates in Excel 2003
    By Benisato in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-22-2012, 03:53 AM
  4. Remove Duplicate Pairs(2 Columns)
    By deathswan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-31-2006, 08:25 PM

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