Comparing two strings in Excel?

I need to compare two strings in excel and determine if they are equal, the strings are in adjacent cells. For example, given:

apple apple
water water
pear carrot
apple water
dog dog
pear carrot
Apple apple

the formula on the third column should give me:

true
true
false
false
true
false
false

Any help appreciated, Ted

2 Answers

Use the built in exact() function which is exact-ly for this purpose:

=exact(A1, B1)

It will return true if the strings are identical.

1

If case in your third column result is not important, =A1=B1. If case in your result does matter, =IF(A1=B1,"true","false").

This comparison (=A1=B1) is slightly different than the exact comparison since case sensitivity of the characters is not compared. The exact function also compares the character case. If you need case sensitivity checked and specify your own results, use =IF(EXACT(A1,B1),"true","false").

You Might Also Like