+ Reply to Thread
Results 1 to 2 of 2

Find unique values between 2 columns

Hybrid View

  1. #1
    Registered User
    Join Date
    11-06-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1

    Find unique values between 2 columns

    I have a single worksheet with 2 columns with overlapping data, meaning that there is some duplicate content between the 2 columns. Ideally, what I'd like is to magically create 2 new columns - 1 with a consolidated list of data present in column a and not in column b, and the other with the reverse.

    What's the easiest way to accomplish that or even the correct search terms to find the answer myself?


    thanks,
    will

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Find unique values between 2 columns

    Here's one that will compare columns A and B and put the ones found in A but not B in C and the ones found in B but not in A in D:

    Sub Willa(): Dim A As Range, B As Range, p As Long, q As Long
                        p = 1: q = 1
    For Each A In Range("A2:A" & Range("A" & Rows.count).End(xlUp).row)
    For Each B In Range("B2:B" & Range("B" & Rows.count).End(xlUp).row)
    If A = B Then GoTo GetNextA
    Next B
    p = p + 1: Cells(p, 3) = A
    GetNextA: Next A
    
    For Each B In Range("B2:B" & Range("B" & Rows.count).End(xlUp).row)
    For Each A In Range("A2:A" & Range("A" & Rows.count).End(xlUp).row)
    If A = B Then GoTo GetNextB
    Next A
    q = q + 1: Cells(q, 4) = B
    GetNextB: Next B
    
    End Sub
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

+ 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] Find count of Unique or Duplicate Values based on Concatenated values in 2 columns
    By bdicarlo1 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-03-2014, 12:42 AM
  2. Find unique values from 2 columns
    By Ronnie_Greytruck in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-22-2013, 06:25 PM
  3. Replies: 1
    Last Post: 04-19-2013, 08:30 PM
  4. 3 columns: None contain unique values, but I need a list of every unique set
    By mathematician in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-15-2012, 04:47 PM
  5. Macro to Find unique values in three columns
    By RahulRaman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-21-2009, 06:53 AM

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