1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Checking data in seperate columns and finding mismatches

Discussion in 'Business Applications' started by InsertSmthHere, Dec 21, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. InsertSmthHere

    InsertSmthHere Thread Starter

    Joined:
    Dec 21, 2008
    Messages:
    8
    Hi guys,

    I've been going through this thread and its been a lot of help. I've now come across a problem that i cant find the solution to and im hoping someone can help me out.

    I have a file that contains two columns of data in MS Excel and one value in the first column corresponds to a value in the second column. For example -

    Column 1 Column 2
    A1 X
    A1 X
    B2 Y
    A1 X
    B2 Y

    What I have to do is find if there are any mismatches in the data for example an X corresponding to B2 instead of A1 or vice versa (or any other value instead of X and Y in the second column for that matter). I would need a message saying there are a particular number of errors and the rows in error should be highlighted. I DONT need the corrections just need to see where the mismatches are.

    Im pretty new to Macros and VB, so please bear with me :D, but i do understand the basics and ive done some programming before.

    Any help would be greatly appreciated :). Thanks
     
  2. InsertSmthHere

    InsertSmthHere Thread Starter

    Joined:
    Dec 21, 2008
    Messages:
    8
    oops.. the X's and Y's are supposed to be in column 2.
    That didnt quite show up how i expected it to..
     
  3. turbodante

    turbodante

    Joined:
    Dec 19, 2008
    Messages:
    744
    You don’t need to use macros here if you have only two test to perform ie.
    A1 = X
    B2 =Y
    You’ll just need to make the comparison in a third column,
    =if(or(and(Column1=”A1”,Column2=”X”) ,and(Column1=”B2”,Column2=”Y”),”OK”,”MisMatch”)
    in column C

    =IF(OR(AND(A4="A1",B4="x"),AND(A4="B2",B4="y")),"Okay","")
     
  4. InsertSmthHere

    InsertSmthHere Thread Starter

    Joined:
    Dec 21, 2008
    Messages:
    8
    Yea that makes sense.

    I did however solve it with a simple if statement using a macro. I just didnt think i cud do something like if ValueColumn1 = "A1" AND ValueColumn2 = "X" Then etc. etc.

    Thanks for your help though.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/782032

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice