In Excel, you can compare two strings with each other by comparing with two methods:
- Case Sensitive
- Non-Case Sensitive
In this tutorial, we will learn to write a formula for both methods.
Compare Two Strings with Non-Case Sensitive Match
- First, enter (=) sign in a cell.
- Refer to the cell with the first value.
- Again enter (=).
- Refer to the cell with the second value.
- In the end, hit enter to get the result.
You can see in the above example; in the first cell, you have “Excel,” and in the second cell, you have “EXCEL”. Both values are the same; the only difference is the case. And in the result, we have TRUE.
As I said, this formula will not consider the case of the text while comparing.
=text1 = text2
Compare Two Strings with Case Sensitive Match
But if you want also to consider the case of the text while matching, you can use the EXACT function.
- Enter the EXACT function in a cell.
- Refer to the cell with the first value.
- Type a comma.
- Refer to the cell with the second value.
- Close the function and hit enter to get the result.
In the above example, we have the same values in all the cells, but you have TRUE, where the value is the same along with the case match.
Using IF to Compare Two Texts
You can also combine IF with both methods we have discussed above.
=IF(A1=B1,"Yes","No")
=IF(EXACT(A2,B2),"Yes","No")
Get the Excel File
Related Formulas
- Create a Horizontal Filter in Excel
- Create a Star Rating Template in Excel
- Get File Name in Excel
- Get Sheet Name in Excel
- Quickly Generate Random Letters in Excel
- Randomize a List (Random Sort) in Excel
- Count Characters in Excel (Cell and Range)
- Get File Path (Excel Formula)
- Get the Value from a Cell