You can use the following methods to compare strings in cells A2 and B2 in Google Sheets:
Method 1: Compare Strings (Case-Sensitive)
=EXACT(A2, B2)
This formula returns TRUE if the two strings have identical characters in identical cases. Otherwise it returns FALSE.
Method 2: Compare Strings (Case-Insensitive)
=EXACT(UPPER(A2), UPPER(B2))
This formula returns TRUE if the two strings have identical characters, regardless of case. Otherwise it returns FALSE.
The following examples show how to use each method in practice with the following columns of strings in Google Sheets:
Example 1: Compare Strings in Google Sheets (Case-Sensitive)
We can type the following formula into cell C2 to check if the strings in cell A2 and B2 are equal, including their case:
=EXACT(A2, B2)
We can then drag and fill this formula down to each remaining cell in column C:
The formula in column C only returns TRUE if the characters in each string and the cases of the characters are identical.
Otherwise, the formula in column C returns FALSE.
For example:
- Panda and panda have the same characters but they’re not in the same case, so the formula returns FALSE.
- lion and lion have the same characters and they’re in the same case, so the formula returns TRUE.
And so on.
Example 2: Compare Strings in Google Sheets (Case-Insensitive)
We can type the following formula into cell C2 to check if the strings in cell A2 and B2 are equal, regardless of case:
=EXACT(UPPER(A2), UPPER(B2))
We can then drag and fill this formula down to each remaining cell in column C:
The formula in column C returns TRUE if the characters in each string are equal, regardless of case.
Otherwise, the formula in column C returns FALSE.
Note that this formula uses the UPPER function to first convert each string to uppercase before comparing the characters.
This is equivalent to performing a case-insensitive comparison since it guarantees that each string is converted to all uppercase characters before performing the comparison.
Additional Resources
The following tutorials provide additional information on how to work with dates in Google Sheets:
How to Remove Substring in Google Sheets
How to Reverse a Text String in Google Sheets
How to Extract Numbers from String in Google Sheets