Exact Function - Case Sensitive Comparison in Excel

Add to Favorites
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.

Returns

TRUE or FALSE

Simple Example - Compare Values

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

=EXACT(A2,B2)

124647adf14cf4a1124dbcaf1c0d01ed.png

Result

9a93c371d2622a1dd3ef81ae6f3df7f0.png

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.

690c0c065af44da10539623e65fcd263.png

Result

f89a6e61e501084713a51432e2ccc61d.png

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.")

3a2e81ffe224de4c16e282691c82d51f.png

Result

27effcb9e9d1829447b4260b3568005e.png

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:

https://www.youtube.com/watch?v=nUEEH_xdu30

https://www.youtube.com/watch?v=nUeEH_xdu30

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()
Downloadable Files: Excel File

Question? Ask it in our Excel Forum


Excel VBA Course
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.)

View Course

Tutorial Details
Excel Function: EXACT(), IF()
Downloadable Files: Excel File
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
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.)

View Course