The Excel EXACT function compares two text strings and returns TRUE only if they match character for character, case included. That last part is the whole point: Excel’s = operator thinks “Apple” and “APPLE” are equal, and so do VLOOKUP, XLOOKUP, and MATCH. When case actually matters — passwords, product codes, serial numbers — EXACT is the only built-in comparison that tells the truth.
=A2=B2, which ignores case entirely.
Syntax
| Argument | Description | |
|---|---|---|
text1 | Required | The first text string, or a reference to it. |
text2 | Required | The second text string to compare against the first. |
EXACT is case-sensitive but format-blind: it compares the underlying values, so the number 12 matches “12” displayed as $12.00. Every character counts — including spaces you can’t see.
Available in: every version of Excel — no compatibility concerns anywhere.
EXACT vs. the = operator
This is the contrast that makes EXACT worth knowing. The = operator in column C waves through every capitalization; EXACT in column D holds the line:
| A | B | C | D | |
|---|---|---|---|---|
| 1 | text1 | text2 | =A2=B2 | =EXACT(A2,B2) |
| 2 | apple | apple | TRUE | TRUE |
| 3 | Apple | apple | TRUE | FALSE |
| 4 | APPLE | apple | TRUE | FALSE |
| 5 | apple | apple | FALSE | FALSE |
Row 5 shows a bonus feature: trailing spaces fail both tests — but only EXACT is guaranteed to flag every difference, which makes it a great data-audit tool:
Try it: interactive EXACT demo
Type two strings and compare them both ways. Toggle the operator to see where = and EXACT disagree.
Case-sensitive lookups, counts, and validation
None of Excel’s lookup functions respect case on their own — but feed EXACT an entire range and it returns an array of TRUE/FALSE that MATCH can search. That combination is the classic case-sensitive lookup:
(In Excel 2019 and earlier, confirm with Ctrl+Shift+Enter. Excel 365 handles the array natively.)
Case-sensitive counting works the same way — EXACT marks the true matches, SUMPRODUCT adds them up:
Validate codes as they’re entered. Use EXACT inside Data Validation › Custom to insist on uppercase region codes:
365 alternative: =FILTER(B2:B100, EXACT(A2:A100, D2)) returns all case-sensitive matches at once, not just the first.
Errors & common pitfalls
Pitfall: assuming = is case-sensitive. It isn’t — and neither are VLOOKUP, XLOOKUP, MATCH, COUNTIF, or SUMIF. If two “different” codes keep matching each other, case-blindness is why. EXACT is the fix, not a switch on the other functions.
Pitfall: invisible characters cause FALSE on “identical” text. A trailing space or a CHAR(160) from a web paste fails EXACT even though both cells look the same. Scrub both sides first: =EXACT(TRIM(CLEAN(A2)), TRIM(CLEAN(B2))).
Pitfall: EXACT ignores formatting, not value type. =EXACT(12, "12") is TRUE — the number is converted to text before comparing — but =EXACT(TEXT(A2,"0.00"), B2) lets you compare the displayed form when that’s what matters.
#N/A from MATCH(TRUE, EXACT(...), 0). No case-perfect match exists — or, in older Excel, the formula wasn’t entered as an array (Ctrl+Shift+Enter). Wrap with IFERROR for a friendly message: =IFERROR(INDEX(...), "Not found").
Pitfall: don’t use EXACT when case shouldn’t matter. For ordinary matching, plain = or a normal lookup is faster and reads cleaner. Reach for EXACT only when capitalization is part of the data’s meaning.
Practice workbook
Frequently asked questions
What's the difference between EXACT and the = operator?
="Apple"="apple" returns TRUE because the = operator ignores capitalization; =EXACT("Apple","apple") returns FALSE because EXACT compares character for character. Everything else — spaces, punctuation, length — both tests treat the same.How do I do a case-sensitive VLOOKUP?
=INDEX(B2:B100, MATCH(TRUE, EXACT(A2:A100, D2), 0)). In Excel 2019 and earlier, confirm with Ctrl+Shift+Enter.How do I count cells with a case-sensitive criteria?
=SUMPRODUCT(--EXACT(A2:A100, "ID-x9")). The double minus turns EXACT’s TRUE/FALSE array into 1s and 0s that SUMPRODUCT can total.Why does EXACT return FALSE when both cells look identical?
=EXACT(TRIM(CLEAN(A2)), TRIM(CLEAN(B2))).Does EXACT work on numbers?
=EXACT(TEXT(A2,"0.00"), TEXT(B2,"0.00")).How do I check that a code was typed in all caps?
=EXACT(A2, UPPER(A2)) is TRUE only when A2 contains no lowercase letters. It makes a tidy Data Validation › Custom rule for enforcing code formats.Master functions like this in one day
This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class