Compare two strings

Generic formula 

=EXACT(text1, text2)

Related formulas 

Case sensitive match

Count cells equal to case sensitive

Explanation

If you need to two text strings in Excel to determine if they're equal, you can use the EXACT function. For example, if you want to compare A2 with B2, use:

=EXACT(A2,B2)

If the two strings are identical, EXACT will return TRUE. If not, EXACT will return FALSE. You can use this result inside the IF function to display a message or make a conditional calculation. For example, to display the message "Yes" for a match and "No" if not, use:

=IF(EXACT(A2,B2),"Yes","No")

Note that the EXACT function is case sensitive. If you don't care about case, you can simply use the equal sign like so:

=A2=B2

This formula will return TRUE or FALSE, but will treat "Apple" and "apple" as the same.

Compare two strings

Generic formula 

=EXACT(text1, text2)

Related formulas 

Case sensitive match

Count cells equal to case sensitive

Explanation

If you need to two text strings in Excel to determine if they're equal, you can use the EXACT function. For example, if you want to compare A2 with B2, use:

=EXACT(A2,B2)

If the two strings are identical, EXACT will return TRUE. If not, EXACT will return FALSE. You can use this result inside the IF function to display a message or make a conditional calculation. For example, to display the message "Yes" for a match and "No" if not, use:

=IF(EXACT(A2,B2),"Yes","No")

Note that the EXACT function is case sensitive. If you don't care about case, you can simply use the equal sign like so:

=A2=B2

This formula will return TRUE or FALSE, but will treat "Apple" and "apple" as the same.