EXACT Function

Excel Functions › Text

All Excel versions Text

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.


Quick answer: to test whether A2 and B2 are identical, including capitalization:
=EXACT(A2, B2)
TRUE means a perfect character-for-character match. Compare with =A2=B2, which ignores case entirely.

Syntax

=EXACT(text1, text2)
ArgumentDescription
text1RequiredThe first text string, or a reference to it.
text2RequiredThe 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:

ABCD
1text1text2=A2=B2=EXACT(A2,B2)
2appleappleTRUETRUE
3AppleappleTRUEFALSE
4APPLEappleTRUEFALSE
5apple  appleFALSEFALSE
=EXACT(A2, B2) // TRUE only for a character-perfect match

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:

=IF(EXACT(A2, B2), "match", "DIFFERS") // audit two columns that should be identical

Try it: interactive EXACT demo

Live 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:

=INDEX(B2:B100, MATCH(TRUE, EXACT(A2:A100, D2), 0)) // find D2 in A, case-sensitively; return from B

(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:

=SUMPRODUCT(--EXACT(A2:A100, "ID-x9")) // counts ID-x9 but not id-X9

Validate codes as they’re entered. Use EXACT inside Data Validation › Custom to insist on uppercase region codes:

=EXACT(A2, UPPER(A2)) // TRUE only if A2 contains no lowercase letters

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

📊
Download the free EXACT practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What's the difference between EXACT and the = operator?
Case. ="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?
You can’t make VLOOKUP itself case-sensitive — combine INDEX and MATCH with EXACT instead: =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?
COUNTIF ignores case, so use SUMPRODUCT with EXACT: =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?
Something invisible differs — usually a trailing space or a non-breaking space (CHAR(160)) from pasted web data. Clean both sides before comparing: =EXACT(TRIM(CLEAN(A2)), TRIM(CLEAN(B2))).
Does EXACT work on numbers?
Yes — numbers are converted to text and compared by value, ignoring formatting, so =EXACT(12, "12") is TRUE even if the cell shows $12.00. To compare what’s displayed, convert explicitly: =EXACT(TEXT(A2,"0.00"), TEXT(B2,"0.00")).
How do I check that a code was typed in all caps?
Compare the cell with its own uppercase version: =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

Related functions: SUBSTITUTE · TRIM · MATCH · INDEX · XLOOKUP