Example 1
Case matters: = and EXACT disagree
C2 =EXACT(A2,B2)
Result: FALSE
The codes differ in case only. The = operator would say TRUE, but EXACT is strict and returns FALSE.
C2 =EXACT(A2,B2) returns FALSE
Checks whether two pieces of text are identical, including capital letters. Returns TRUE or FALSE.
Syntax
=EXACT(, )
All versions of Excel.
Try it
Edit the formula in C2 or change the inputs. The sheet recalculates as you type.
C2 =EXACT(A2,B2) returns FALSE
EXACT compares two pieces of text and returns TRUE only if they are identical, character for character, including upper and lower case. Use it when the difference between FX-1010 and fx-1010 matters: passwords, case-sensitive codes, and checks for duplicates that differ only in case.
Excel's = operator ignores case. ="FX-1010"="fx-1010" returns TRUE. EXACT returns FALSE for the same pair. For everything else, the two behave alike: if the text differs in any other way, a different letter, a space, a dash, both give FALSE.
EXACT ignores formatting. Bold, colour and number formats make no difference. It compares the stored values, so a cell showing 1,250 because of a number format and a cell holding the text 1250 are compared as 1250 and 1250, and EXACT says TRUE. A number and the same number as text also compare as equal.
A trailing space makes text different. =EXACT("FX-1010","FX-1010 ") returns FALSE. If EXACT unexpectedly returns FALSE for text that looks the same, wrap both sides in TRIM, or compare lengths with LEN to find the hidden difference.
EXACT accepts a range, so it can test a whole list at once. Combined with SUMPRODUCT it counts case-sensitive matches: =SUMPRODUCT(--EXACT(A2:A9,"FX-1010")) counts the cells equal to FX-1010 in capitals. The double minus turns TRUE and FALSE into 1 and 0. COUNTIF would count fx-1010 as well, because it ignores case.
Lookup functions ignore case, so to find a value case-sensitively, use EXACT as the test. In Microsoft 365: =XLOOKUP(TRUE,EXACT(A2:A9,E2),B2:B9). EXACT builds an array of TRUE and FALSE, and XLOOKUP looks for the first TRUE. In older versions, INDEX and MATCH can do the same: =INDEX(B2:B9,MATCH(TRUE,EXACT(A2:A9,E2),0)), entered with Ctrl+Shift+Enter.
In a conditional formatting rule or data validation, EXACT lets you flag entries that differ from a master value only in case. Anything that must match a reference code exactly can use =EXACT(A2,$E$1) as its test.
FIND and SUBSTITUTE are also case-sensitive, but they search within text. EXACT compares whole values. If you want to compare without caring about case, use = or convert both sides with LOWER.
A2.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
C2 =EXACT(A2,B2)
Result: FALSE
The codes differ in case only. The = operator would say TRUE, but EXACT is strict and returns FALSE.
C2 =EXACT(A2,B2) returns FALSE
Example 2
C2 =EXACT(A2,B2)
Result: TRUE
Every character, including the case, matches.
C2 =EXACT(A2,B2) returns TRUE
Example 3
C2 =EXACT(A2,B2)
Result: FALSE
A2 has a space at the end. EXACT sees it, and so does a lookup. EXACT(TRIM(A2),B2) would return TRUE.
C2 =EXACT(A2,B2) returns FALSE
Example 4
D2 =SUMPRODUCT(--EXACT(A2:A5,"FX-1010"))
Result: 2
EXACT tests every cell in A2:A5, and SUMPRODUCT adds the TRUE results. COUNTIF would return 3 because it ignores case.
D2 =SUMPRODUCT(--EXACT(A2:A5,"FX-1010")) returns 2
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In C2, return TRUE if the code in A2 exactly matches the master code in B2, including case, and FALSE otherwise. Fill it down to C5.
Answer in C2, then it fills down to C5.
LEN of both sides.= instead. EXACT is only needed when case matters.Use `=EXACT(A2,B2)`. It returns TRUE only when the text is identical, including capitals. The `=` operator ignores case.
Both return TRUE or FALSE. The = operator ignores upper and lower case, so "ABC"="abc" is TRUE. EXACT is case-sensitive, so EXACT("ABC","abc") is FALSE.
In Microsoft 365, `=XLOOKUP(TRUE,EXACT(A2:A9,E2),B2:B9)`. EXACT produces TRUE for the case-sensitive match, and XLOOKUP finds that TRUE. VLOOKUP and MATCH on their own ignore case.
Use `=SUMPRODUCT(--EXACT(A2:A9,"FX-1010"))`. COUNTIF and COUNTIFS ignore case.
There is probably a hidden difference: a trailing space, a non-breaking space, or a different letter case. Compare `LEN(A2)` and `LEN(B2)`, and try `EXACT(TRIM(A2),TRIM(B2))`.
EXACT is taught in Logic and text, lesson 8: PROPER, UPPER and LOWER. Each lesson is a short, graded exercise like the one above.