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 Microsoft Trainer (MCT) and works as a full-time Trainer at BakerHostetler - one of the largest law firms in the US. Chris runs a YouTube channel with 900+ technology videos that cover various tools such as Excel, Word, Zoom, Teams, Gmail, Copilot, Google Calendar, and Outlook. To date, the channel has helped over 20 million viewers. Menard also does 2 to 3 public speaking events yearly, presenting at the Administrative Professional Conference (APC), the EA Ignite Conference, the University of Georgia, and CPA conferences. You can connect with him on LinkedIn at https://chrismenardtraining.com/linkedin or watch his videos on YouTube at https://chrismenardtraining.com/youtube.

Categories