+ Reply to Thread
Results 1 to 20 of 20

How to display mismatches found between two columns?

  1. #1
    Registered User
    Join Date
    03-22-2014
    Location
    Latvia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Question How to display mismatches found between two columns?

    Hello!

    I have to make one task but I have no idea how to do it, as I am a beginner in vba. It would be nice if you could help me)

    So I have two columns (A and B). It is needed to compare these two and display MISmatches in column C by using macros. The amount of numbers can be various! Sounds simple but when I started, I realized that I feel prety hopless in it.

    Looking foreward for any suggestions, examples, or explanations.

  2. #2
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: How to display mismatches found between two columns?

    Hi,

    Welcome to the forum. Could you provide a sample of the workbook with a before and after? That would make things a lot easier when trying to get help. Make sure you remove any sensitive information.

    Regards
    Last edited by fredlo2010; 03-22-2014 at 06:57 PM.

  3. #3
    Registered User
    Join Date
    03-22-2014
    Location
    Latvia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to display mismatches found between two columns?

    help.jpg

    for example:
    So column A contains 1,2,3,..20
    B contains 1,2,3,..10,21,22,23,..30

    As numbers 11,12,13,..20 in A are not seen in B then it is needed to put these numbers in C

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to display mismatches found between two columns?

    A
    B
    C
    D
    1
    1
    1
    C1 and down: =IF(COUNTIF(B:B,A1)=0, A1, "")
    2
    2
    2
    3
    3
    3
    4
    4
    4
    5
    5
    5
    6
    6
    6
    7
    7
    7
    8
    8
    8
    9
    9
    9
    10
    10
    10
    11
    11
    21
    11
    12
    12
    22
    12
    13
    13
    23
    13
    14
    14
    24
    14
    15
    15
    25
    15
    16
    16
    26
    16
    17
    17
    27
    17
    18
    18
    28
    18
    19
    19
    29
    19
    20
    20
    30
    20
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    03-22-2014
    Location
    Latvia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to display mismatches found between two columns?

    It is important for me to do this task exately in macro by sub function! Any ideas how to do this?

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: How to display mismatches found between two columns?

    And why would that be important to you?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Registered User
    Join Date
    03-22-2014
    Location
    Latvia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to display mismatches found between two columns?

    That is the taks what I have been given, I must solve it.
    I found code for case when it puts out values that matches

    Please Login or Register  to view this content.
    So I need something like that but what puts out values what MISmatches

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: How to display mismatches found between two columns?

    homework??

    And please use code tags when posting code - I will do it for you...this time

  9. #9
    Registered User
    Join Date
    03-22-2014
    Location
    Latvia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to display mismatches found between two columns?

    Yes, homework))
    Ok, just tell what is the code tags?)
    Anyway thanks for helping?

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to display mismatches found between two columns?

    Try the attached.
    Attached Files Attached Files
    Last edited by AB33; 03-22-2014 at 08:59 PM.

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: How to display mismatches found between two columns?

    Ok, just tell what is the code tags?)
    See my notes at the bottom of my 1st post to you

  12. #12
    Registered User
    Join Date
    03-22-2014
    Location
    Latvia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to display mismatches found between two columns?

    Quote Originally Posted by AB33 View Post
    Try the attached.
    Could not get in, what is "Option Explicit"? What do you mean by that?

  13. #13
    Registered User
    Join Date
    03-22-2014
    Location
    Latvia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to display mismatches found between two columns?

    Quote Originally Posted by FDibbins View Post
    See my notes at the bottom of my 1st post to you
    Ok, here is the code with tags:

    Please Login or Register  to view this content.
    I hope that this is what You expected for me to do
    So, You have anything supercool to teach me?
    Last edited by FDibbins; 03-22-2014 at 09:49 PM.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: How to display mismatches found between two columns?

    I had actually added them for you already. There are 2 ways to add code tage

    1. Use code tags for VBA. [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code]
    2. highlight your code and then click the # icon

  15. #15
    Registered User
    Join Date
    03-22-2014
    Location
    Latvia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to display mismatches found between two columns?

    Quote Originally Posted by FDibbins View Post
    I had actually added them for you already. There are 2 ways to add code tage

    1. Use code tags for VBA. [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code]
    2. highlight your code and then click the # icon
    Thanks, now with the code tags everything is completely clear but still I cannot get clerity with this task. Please try to make some clerity in my dark mind 'couse Im not going to calm down until I get the answer (maybe the answer has been given but as it so as You can see I have lost in this forum, so show me in that case)

  16. #16
    Registered User
    Join Date
    03-10-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to display mismatches found between two columns?

    Try this.. Just add the code to your module

    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    02-24-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: How to display mismatches found between two columns?

    Use this;

    Please Login or Register  to view this content.
    Last edited by Jim885; 03-23-2014 at 11:08 AM.
    If I helped in any way, please click the star

  18. #18
    Forum Contributor
    Join Date
    02-24-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: How to display mismatches found between two columns?

    MaterialMaster,

    According to my test, your code does not run to the last row. It stops one row short of the end.

    I had to make this small modification for it to work for me;
    Please Login or Register  to view this content.
    Did you get to the last row with your code as originally written?

  19. #19
    Registered User
    Join Date
    03-10-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to display mismatches found between two columns?

    Yeah this worked fine. Maybe because I started from row 1?

  20. #20
    Forum Contributor
    Join Date
    02-24-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: How to display mismatches found between two columns?

    Yep, that was it. I forgot that I changed your code sliglthy to start ar row 2.
    Thanks for catching my overlooking that part.

+ 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. Match two columns of data - return mismatches third column
    By Silge in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-22-2014, 06:53 AM
  2. [SOLVED] Count Formula for Matches in One Column and Mismatches in Another
    By xcel-noob in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-27-2014, 03:46 PM
  3. Compare cell values in two different columns for mismatches
    By maacmaac in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-11-2012, 01:33 AM
  4. If value found display X, else Y
    By N-ter in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 08-23-2011, 02:02 PM
  5. Dynamic arrays and type mismatches
    By carg1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-01-2005, 03:13 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