• Status: Solved
• Priority: Medium
• Security: Public
• Views: 345

# Excel - compare columns

In Excel, is there a way to compare column A and B and highlight if the different?

sample

accountnumber_A      accountnumber_B

12345                         11111
7890                           22222
2222                           12345
etc
0
VBdotnet2005
1 Solution

Commented:
you can use COUNTIF to determine if a value appears in one column of data from the other...

So to see if the value in A1 is in column B you can use:

=CountIF(B:B,A1)

Or you can use MATCH which will return the row number for the first matching data:

=MATCH(A1,B:B,0)
0

Commented:
Do you want to compare row by row or compare a value in one column against any value in the other?

If it's the former you can just use

=A2=B2

or to compare A2 against any value in column B

=COUNTIF(B:B,A2)>0

You can use either formula on the worksheet and copy down the columns......or use within conditional formatting to format the relevant cells as required

regards, barry
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.