This should be quick and easy.

I want to compare two columns and flag any mismatches in a third column. What is the easiest way?

Sample output:

1   |      A          B       C
2   |  =========  =========  ===
3   |  apple      apple       
4   |  banana     bananas     1
5   |  orange     orange
6   |  melon      melon
7   |  lemon      lEmon       1
link|improve this question
feedback

1 Answer

up vote 3 down vote accepted

Why does this look like a homework-assignment? ... /tease. Try something like:

=A1=B1

for your formula. This will return true/false, which may not be what you want 100%... but it's the most efficient method. Alternatively, you can rely on the IF statement... to get exact results... like this:

=IF(A1=B1,"1","")

IF is not very CPU efficient... but it'l do the job. If you need a case-sensitive check... use the EXACT function instead. i.e.

=EXACT(A1,B1)

or

=IF(EXACT(A1,B1),"1","")
link|improve this answer
Thanks a lot. :) Not a homework assignment, just a quickie on Excel (I am a PHP guy and was gonna write a quick script to process this, but I knew there had to be a super simple way to do it. Thanks for the comprehensive answer!). – R C Jan 4 at 15:16
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.