The Computer Oracle

Comparing two strings in Excel?

Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Meditation

--

Chapters
00:00 Question
00:36 Accepted answer (Score 71)
00:55 Answer 2 (Score 28)
01:37 Thank you

--

Full question
https://superuser.com/questions/284022/c...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#microsoftexcel #comparison

#avk47



ACCEPTED ANSWER

Score 72


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.




ANSWER 2

Score 29


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").