Wednesday, June 1, 2011

Excel tip- How do I Check IF two values match (or differ)

Sometimes, in Excel, you need to see if two columns of data have matching (or different) values.

This can be easily accomplished by using the IF() function.

The IF() function takes 3 arguments (or pieces of info):

  1. The Logical Test
  2. The value to return if logical test returns TRUE
  3. The value to return if logical test returns FALSE

In plain English it would look like this: "IF the data in field A2 is equal to the data in B2 then print the word 'MATCH' otherwise print the word 'Doesn't match'".

Now let's take a look at how to accomplish this in Excel.
  • Open your spreadsheet and add a column with a header.
  • Click the small arrow that is next to the auto sum button .
  • Select More Functions....












  • In the resulting pop-up type IF into the Search for a function box and click GO.
  • Select IF in the Select a Function list and click OK




















  • In the Logical_test field type in your comparison.  For example you can check to see if the value in cell A2 match the value in B2 by clicking in the Logical_test field in the pop_up, clicking in field A2, typing an equal sign (=) and then clicking in field B2.

  • Directly to the right of the Logical_test field you should see if your results return true or false.

  • In the Value_if_True box type what you would like returned if the logical_test returns true.  Example: "Yes", "True", "They Match"

  • Do the same for the Value_if_false field. Example: "No", "False", "uh oh".
  • Again, you should see what the values will look like for each choice on the right hand side as well as the value for the row you have built your formula in, on the bottom.













  • Click OK.
  • To expand the Formula to all your rows you can click the field that contains your formula, hover over it with the mouse in the very left, bottom corner of the field and click and drag the small square(your cursor will turn in to a small solid black cross).  You can also double click this small square to have it fill all the rows in your spread sheet for you.
  • Have a beer you just saved yourself some time from having to look at every row in your sheet!


     


A few additional notes:
  • You don't need to limit yourself to the equal operator in the Logical_test.  You can use <, > or < > (does not equal).  
  • You don't need to limit yourself to text in the Value if True/False fields.  You can return a value from another cell by clicking the cell or you can insert another formula here as well.

No comments:

Post a Comment