Excel Formula: If Exact Match Then


You can use the following syntax in Excel to create an IF statement that checks if the text in two cells exactly match:

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

This particular formula checks if the text in cells A2 and B2 are an exact match and returns either “Yes” or “No” as a result.

Note: Feel free to replace “Yes” and “No” with whatever other values you’d like to return.

The following example shows how to use this syntax in practice.

Example: Use IF Statement to Check for Exact Match in Excel

Suppose we have the following list of student names from two different classes in Excel:

Suppose we would like to check if the names in corresponding cells in each column are an exact match.

We can type the following formula into cell C2 to do so:

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

The following screenshot shows how to use this formula in practice:

Excel if exact match

Column C returns either “Yes” or “No” to indicate if the text in corresponding cells in columns A and B are exact matches.

Note that in order for the EXACT function to return TRUE, the text must have the same characters in the same positions and have the same case.

Also note that you could instead return a cell value instead of “Yes” or “No” in the IF statement.

For example, you could use the following formula to return the name of the student in column A if the name exactly matches the corresponding name in column B or a blank otherwise:

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

The following screenshot shows how to use this formula in practice:

The IF statement now returns the name from column A if it exactly matches the name in column B or a blank cell otherwise.

x