Beyondrelational

Thursday, October 21, 2010

Excel compare two column values

Excel compare two column values:
-----------------------------------
Hopefully this is an easy one for you.  I have two columns of alphanumeric data that I want to compare.  The data in each column is a list of computer names.  I want to know what computers names in column A are NOT in column B.  Can you assist?  The output can be either in column C or in a separate worksheet.  Thanks in advance for any help you can provide.

Answer
In cell C1, enter the formula:

=IF(ISERROR(MATCH(A1,B:B,0)),A1,"")

and copy it down col C as far as your data goes. Calculate, and Col C will display all the computer names that appear in Col A but not Col B. (If desired, you can use sort to bring the Col C results to the top, or use advanced filter to extract the unique values of Col C elsewhere.)


**************************************************************

=A$1<>B$1 or =(A$1:A$10)<>B$1


***************************************************************

One way is to use conditional formatting.
 
Suppose the first column is A and the second is B.
 
Select A1 and use
 
Format >> Conditional formatting >> Formula is
 
Then put for the formula
 
=COUNTIF(B:B, A1)=0
 
Then click
 
Format >> Patterns
 
And choose a background color of your choice, followed by clicking OK and
 
OK again.
 
Finally, with A1 still selected, click the paintbrush and then spread the
 
paint down the list of values in column A; this paints the conditional
 
formatting onto those cells.

****************************************************************************

=if(A1<>B1,1,"")

*************************************************************

No comments:

Post a Comment