+ Reply to Thread
Results 1 to 16 of 16

compare values from 2 columns and display the unique values in other column

  1. #1
    Registered User
    Join Date
    08-25-2016
    Location
    kay ell
    MS-Off Ver
    2007
    Posts
    33

    compare values from 2 columns and display the unique values in other column

    hello all

    let say i have 3 columns

    column a is the new entry , column b is the data , and column c is the result

    column b is my database actually , column a is the new entry , that i want to compare to column a

    so the result will appear in column c

    column a is new entry , it have , 14 , MARY , JOHN , 20

    column B is my datalist , it have , JOHN , BOB, 14 ,12

    so i need the column c showed MARY and 20

    untitled1.jpg

    thanks in advance
    Last edited by smatbis; 06-20-2017 at 09:48 AM. Reason: problem solved

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: compare values from 2 columns and display the unique values in other column

    Using some old code I had this should work more or less... I must admit I did not try a re-write to condense the 2 functions it calls, which I changed slightly a while back but for which I can't take credit.

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

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

    Re: compare values from 2 columns and display the unique values in other column

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: compare values from 2 columns and display the unique values in other column

    @ JOHN: OK OK.... mine is overly complicated for the application, I get it....
    lol just kidding around eh! Nice solution

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

    Re: compare values from 2 columns and display the unique values in other column

    @ Arkadi: As usually you're faster on the trigger. Looks like we posted just seconds apart.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: compare values from 2 columns and display the unique values in other column

    @ John in this case I just had some code lying around to compare arrays (based on recordset data originally, not spreadsheets), your solution is much simpler and presumably better suited to this situation, I like it!

  7. #7
    Registered User
    Join Date
    08-25-2016
    Location
    kay ell
    MS-Off Ver
    2007
    Posts
    33

    Re: compare values from 2 columns and display the unique values in other column

    thanks for the code sir although its complicated for noob like me to follow it

    anyway appreciate it very much, thanks

  8. #8
    Registered User
    Join Date
    08-25-2016
    Location
    kay ell
    MS-Off Ver
    2007
    Posts
    33

    Re: compare values from 2 columns and display the unique values in other column

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.

    awesome sir...muchly appreciated..

    just 1 thing i curious...

    let say..i want unique data in column a and b , that is not duplicated , shows in column c..

    refer ro picture below , thanks again

    8888.jpg

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

    Re: compare values from 2 columns and display the unique values in other column

    ? That's what the current code does. If you want the opposite then:

    Please Login or Register  to view this content.

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: compare values from 2 columns and display the unique values in other column

    @John I believe what the OP wants is both unique in A and unique in B, all listed in C

  11. #11
    Registered User
    Join Date
    08-25-2016
    Location
    kay ell
    MS-Off Ver
    2007
    Posts
    33

    Re: compare values from 2 columns and display the unique values in other column

    Quote Originally Posted by JOHN H. DAVIS View Post
    ? That's what the current code does. If you want the opposite then:

    Please Login or Register  to view this content.


    thanks again sir

    but when when i run the first code, no 12 and BOB that include in column B doesnt show in column c as result

    it only show MARY and 20

    what i want to do is the result in colum c show MARY , 20 , 12 and BOB

    the first code fulfill my first request without doubt

    then i wonder if i want to show all the unduplicated data in column C as my second request, tq
    Last edited by smatbis; 06-20-2017 at 09:39 AM.

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

    Re: compare values from 2 columns and display the unique values in other column

    Quote Originally Posted by Arkadi View Post
    @John I believe what the OP wants is both unique in A and unique in B, all listed in C
    You're right! Now I understand.

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

    Re: compare values from 2 columns and display the unique values in other column

    If Order doesn't matter then:

    Please Login or Register  to view this content.
    Or if it does (as you have in your sample)
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    08-25-2016
    Location
    kay ell
    MS-Off Ver
    2007
    Posts
    33

    Re: compare values from 2 columns and display the unique values in other column

    Quote Originally Posted by JOHN H. DAVIS View Post
    If Order doesn't matter then:

    Please Login or Register  to view this content.
    Or if it does (as you have in your sample)
    Please Login or Register  to view this content.

    wowww..superfast sir...thank you and thank you again..works like a charm..

  15. #15
    Registered User
    Join Date
    08-25-2016
    Location
    kay ell
    MS-Off Ver
    2007
    Posts
    33

    Re: compare values from 2 columns and display the unique values in other column

    Quote Originally Posted by JOHN H. DAVIS View Post
    You're right! Now I understand.
    the first code u provide sir really fulfilled my request
    just then i want to make it difference in my 2nd request , thanks again

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

    Re: compare values from 2 columns and display the unique values in other column

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

+ 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. Replies: 1
    Last Post: 11-16-2013, 05:18 AM
  2. Replies: 8
    Last Post: 09-12-2013, 09:17 AM
  3. Replies: 4
    Last Post: 07-15-2013, 01:37 PM
  4. Compare 2 columns of data and get unique values in the 3rd column
    By Eduard in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 04-04-2013, 08:32 AM
  5. [SOLVED] Pick unique values in column A and display the corresponding values from column B & C
    By nostra in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-17-2013, 01:51 AM
  6. [SOLVED] Compare two columns and list the unique values in 3rd column
    By jewellove in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-10-2013, 10:40 AM
  7. Compare 2 columns for unique values
    By Jim Gregg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2006, 12:40 PM
  8. Replies: 1
    Last Post: 04-02-2005, 01:06 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