Exact Function - Case Sensitive Comparison in Excel

Author: | Edits: don

(Video tutorial's page: Compare Values in Excel - Beginner to Advanced)

Case-sensitive comparison of two text strings or values in Excel.

To do this, we use the EXACT() function.

Sections:

Syntax

Simple Example - Compare Values

IF Statement EXACT Example

Notes

Syntax

``=EXACT(text1,text2)``
Argument Description
text1

The first string to compare.

Can be a cell reference or text entered into the function - if it is text entered directly into the function, you need to surround it with quotation marks.

text2

The secont string to compare.

Can be a cell reference or text entered into the function - if it is text entered directly into the function, you need to surround it with quotation marks.

TRUE or FALSE

Simple Example - Compare Values

Let's compare simple text values to see if they are equal.

``=EXACT(A2,B2)``

Result

The "R" is capitalized in Text 2 but not in Text 1, so the function returns False.

If we try it with the next row, it will return true because "red" and "red" are exactly the same.

Result

IF Statement EXACT Example

The EXACT function becomes a lot more useful when we use it in conjuction with the IF statement.

Let's Check if the value in cell A5 is exactly the same as the value in cell B5 and, if it is, return the value from cell B5, but, if it's not, return descriptive text.

``=IF(EXACT(A5,B5),B5,"Not exact match.")``

Result

In this example, we want to know if two identification values are the same or not - in order to increase the number of possible combinations, websites like YouTube make a distinction between the case of letters for the URLs of the videos.

If you want to test the above example to see how it works in the real world, you can input each of the below URLs into the browser to see the difference:

Notes

The EXACT function is a very useful function that you really need to know. This makes working with your data much more reliable and accurate and it will save you a lot of time. In fact, often people don't even realize that text comparisons in Excel are, by default, not case-sensitive.

Anywhere you use an equals sign to compare a value, you can also use the EXACT function to perform a case-sensitive comparison.

Download the attached sample workbook to work with the above examples in Excel.

Excel Function: EXACT(), IF()

Question? Ask it in our Excel Forum

Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

Tutorial Details
Excel Function: EXACT(), IF()