Excel compare two or more text strings

Posted on:  04/20/2021
Excel compare two or more text strings

To compare two text strings in Excel, you can use the EXACT Function, or you can use =A1=B1.  The EXACT function checks for case sensitivity. Example "Chris" is not the same as "CHRIS" if you use the EXACT function. With =A1=B1, Chris would appear as the same or TRUE.

Excel compare text strings using EXACT function

Excel compare text strings using the EXACT function

EXACT function

The Excel EXACT function compares two text strings, taking into account upper and lower case characters. If the text strings are the same, EXACT returns TRUE. If they are not the same, EXACT returns FALSE. EXACT is case-sensitive.

=EXACT(text1,text2)

Example of = and EXACT

  • A1 is Chris
  • B1 is CHRIS

=A1=B1 will return TRUE. It is not case sensitive. =EXACT(A1,B1) will return FALSE. It is case sensitive.Cell D2 in the screenshot above is using the EXACT Function.  If you want to compare three or more cells, you can use EXACT Function with the AND function. 

 

YouTube video

Excel chart articles

Video Chapters:

  • 00:00 Introduction
  • 00:34 Case-insensitive compare
  • 01:08 Trim spaces either side of strings
  • 01:47 Case-sensitive compare
  • 03:10 Case-insensitive multi-compare

Using AND and EXACT for multiple text strings

 

To compare multiple text strings, use =AND(A15:D15=A15) to compare if you dont' care about case sensitivity, and use EXACT for case sensitivity.=AND(EXACT(A15:D15,A15))

See the screenshot below.

 

EXACT function comparing multiple text strings with AND function

EXACT comparing multiple text strings with AND in cell F15. We get FALSE since France in C15 is not the same as the other cells.

Chris Menard

Chris Menard is a Senior Training Specialist at SurePoint Technologies. Chris is certified in Excel, Word, PowerPoint, and Outlook. Menard has a YouTube channel with other 600 technology videos covering Excel, Word, Zoom, Teams, Outlook, Gmail, Google Calendar, and other resources that over 7 million viewers have very appreciated. Because of Chris's certification and expertise with Microsoft, Chris is a proud member of Microsoft's Creator Team. Being a member of Microsoft's Creator Teams means many of his videos are available on Microsoft 365 YouTube channel and Microsoft support websites.

Categories