+ Reply to Thread
Results 1 to 4 of 4

Finding Identical Values in Two Columns

  1. #1
    Registered User
    Join Date
    10-04-2017
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    8

    Finding Identical Values in Two Columns

    Hello,


    This time, I have to write a sub that checks if a value is duplicate in two columns. If it is, a message box should appear saying "blah." If it is not, a message box should appear saying "okay."


    I have written a code. However, when I run it, I always get the message box saying "okay." This should not happen because there are definitely identical values in the two columns. Any help fixing my code would be great.
    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 10-06-2017 at 11:15 PM.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,249

    Re: Finding Identical Values in Two Columns

    It's not true
    This is how your macro works:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,755

    Re: Finding Identical Values in Two Columns

    You are comparing every cell in the A range to every cell in the B range and then giving a message for every comparison. You are showing 100 messages. What your code is doing is not what you described that you want it to do.

    If you want to check each value in the A range, and give blah if it has a dupe in B and okay if not, then do this. This will give you just 10 messages, one for every value in the A range. I also expanded your message a bit:

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Finding Identical Values in Two Columns

    Hi there,

    Here's one way:

    Please Login or Register  to view this content.
    Please use code tags when posting code as I have done. Thank you.

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

+ 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. Comparing two columns & showing identical values
    By Sham Sundar in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-18-2016, 07:46 AM
  2. Look up identical values in two seperate columns
    By nature718 in forum Excel General
    Replies: 1
    Last Post: 03-20-2014, 06:52 PM
  3. Finding similar but not identical values using COUNT and COUNTIF
    By krixtoffer in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-25-2011, 05:44 AM
  4. Finding similar, but not identical values in two-dimensional datasets
    By krixtoffer in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-24-2011, 04:51 PM
  5. Replies: 1
    Last Post: 11-09-2005, 03:00 PM
  6. Replies: 2
    Last Post: 05-17-2005, 01:32 PM
  7. Replies: 0
    Last Post: 05-14-2005, 03:19 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