The EXACT function can check for an exact match between text strings, including upper and lower case. Formatting does not affect the result. If the text strings are exactly the same, the function result is TRUE; if they're not exactly the same, the result is FALSE.
Besides checking two cells to see if their contents match exactly, you can use the EXACT function to do the following:
The EXACT function has the following syntax:
You can enter the text1 and text2 arguments as cell references or text strings. In Excel 2007, the maximum string length for EXACT is 32767 characters.
In Excel 2007 Help, there is the following statement in the Remarks section for the EXACT function.
"You can also use the double equals (==) comparison operator instead of the EXACT function to make exact comparisons. For example, =A1==B1 returns the same value as =EXACT(A1,B1)."
This is incorrect. There is no "double equals" operator in Excel, and this remark has been removed in the Excel 2010 Help.
You've entered a secret password in a cell in your workbook, and you named that cell "pwd". Users will enter a password, and you'll compare their entry to the contents of the "pwd" cell.
On another sheet, users will enter the password, and you'll use the EXACT function to test it.
If the contents of the two cells are identical, including upper and lower case, cell C5 will show TRUE as the result. Any formatting differences, such as bold font, will be ignored.
If there is a difference in the contents – if even one letter is a different case, the result in C5 will be FALSE.
After the user enters the correct password, you could allow changes to specific cells in the worksheet. For example, a custom data validation formula in cell C5 could control changes to the Daily Rate.
With the following formula in the data validation dialog box, users can enter a value in cell C5 only if the password typed in C3 is an exact match for the secret password in the pwd cell. Also, the value typed in C5 must be higher than zero, and lower than 0.1.
=AND(EXACT(C3,pwd),C5>0,C5<0.1)
You could also use the EXACT function in data validation to ensure that all upper case letters are typed in a cell. For example, a Canadian postal code is a set format, with alternating numbers, and upper case letters, e.g., L9L 9L9.
In cell C2, data validation has been applied, with the formula: =EXACT(C2,UPPER(C2))
If any lower case letters are entered, an error alert will appear. This won't prevent all errors in the postal code, but will ensure that upper case letters are used.
Instead of simply comparing one cell to another, you might need to look for an exact match in a list of values. If someone types a product code in a cell, is that exact code in your product list?
In this example, there is a product code list in cells B2:B5, and a customer can order a product, by typing its code in cell E2.
The formula in cell F2 uses the EXACT function to check the code typed in cell E2, and see if there's an exact match in the list of product codes.
NOTE: The formula is array entered, by pressing Ctrl+Shift+Enter
{=OR(EXACT($B$2:$B$5,E2))}
In a lookup table, the EXACT function can distinguish between AA1 and Aa1, and help return the correct product name for each code. Other functions, like VLOOKUP, would treat those codes as identical, and return the product name for the first code it encounters in the table.
In this example, there is a product code list in cells B2:B5, and a customer can order a product, by typing its code in cell D2.
The formula in cell E2 uses 3 functions – INDEX, MATCH and EXACT:
NOTE: The formula is array entered, by pressing Ctrl+Shift+Enter
{=INDEX($A$2:$A$5,MATCH(TRUE,EXACT($B$2:$B$5,D2),0))}