Excel EXACT Function
EXACT compares two text strings and returns TRUE only if they match exactly, including letter case.
EXACT compares two pieces of text and tells you whether they're identical, character for character, including uppercase and lowercase letters. It returns TRUE if the two match exactly and FALSE if they don't. This matters because Excel's regular equal sign (=) treats "APPLE" and "apple" as the same value. EXACT doesn't.
Syntax
=EXACT(text1, text2)
| Parameter | Required | Description |
|---|---|---|
text1 | Yes | The first text string or cell reference to compare. |
text2 | Yes | The second text string or cell reference to compare against the first. |
Case-sensitive means uppercase and lowercase letters are treated as different characters. "Cat" and "cat" look the same to most Excel formulas, but not to EXACT.
Basic Example
You're reconciling order codes entered by two different warehouse teams. One team types codes in all caps, the other doesn't always match the format. To flag mismatches:
=EXACT(B2, C2)
// B2 = order code entered by Team A, e.g. "SKU-2201"
// C2 = order code entered by Team B, e.g. "sku-2201"
Even though the two codes look identical when you glance at the cells, EXACT returns FALSE. The lowercase letters in C2 don't match the uppercase letters in B2. If both cells contained "SKU-2201" character for character, EXACT would return TRUE.
How EXACT Works
Case sensitivity is the whole point
EXACT is one of the only text functions in Excel that cares about letter case. Every other common comparison, including the = operator, IF conditions, and VLOOKUP, ignores it entirely. Need to tell "Invoice-A" apart from "invoice-a"? EXACT is the tool built for exactly that.
Numbers and dates get converted to text first
EXACT compares values as text, so numbers and dates get converted before the comparison runs. =EXACT(1, "1") returns TRUE. So does =EXACT(1.0, 1), because both sides reduce to the same text string once converted. Formatting differences that change the underlying value are a different story. A date stored as text versus a real date serial number can produce a FALSE result even when the cells display identically. If a date comparison isn't behaving as expected, check the cell's actual content with a formula like =ISNUMBER(A2).
Trailing spaces break the match silently
EXACT counts every character, including spaces you can't see. "Chicago" and "Chicago " look identical in the cell. They aren't. One has a trailing space, so EXACT returns FALSE, with no visual cue telling you why. This is one of the most common causes of unexpected FALSE results, especially with data pasted from another system or a web export.
Comparing a range returns an array
Feed EXACT a range instead of a single cell and it compares position by position, returning an array of TRUE/FALSE values. Compare a column of seven scanned barcode entries against their source list with =EXACT(B2:B8, C2:C8), and Excel returns seven TRUE/FALSE values, one per row. In Excel 365, this spills automatically. Wrap it in AND to collapse the array into a single TRUE or FALSE.
Common Use Cases
Compare two columns for case-sensitive matches
You're auditing a list of employee usernames against a login system export, and case matters for authentication.
=EXACT(A2, B2) // TRUE only if the username matches exactly, including case
Flag records that pass a basic check but fail a strict one
You want to know when two values look the same but aren't identical at the character level.
=IF(EXACT(A2, B2), "Match", "Check formatting")
// A2 = submitted value
// B2 = approved value
// Returns "Check formatting" if casing or spacing differs, even when A2 = B2 evaluates TRUE
Compare several cells at once
Six lab technicians each log a water sample's classification, like "Neutral" or "Acidic," and every entry needs to match exactly before the batch report ships.
=AND(EXACT(B2:G2, B2))
// B2:G2 = the six technician entries for this sample
// B2 = the reference entry every other cell is compared against
// Returns TRUE only if all six entries match B2 exactly, including case
For just two or three cells, a plain OR/AND comparison with the equal sign is often simpler if case doesn't matter. Reach for EXACT plus AND specifically when case sensitivity matters and you're checking more than a couple of cells, since typing out EXACT(A1,B1), EXACT(A1,C1), EXACT(A1,D1) by hand doesn't scale.
Handling Errors
EXACT doesn't generate its own errors when both inputs are valid text or numbers. What it does do is propagate any error already present in the cells you're comparing. If B2 contains #N/A from a failed lookup, =EXACT(B2, C2) returns #N/A too, not FALSE.
Common causes of an error from EXACT:
- One of the compared cells contains an error value carried over from another formula, like
#N/Aor#REF! - A cell reference points to a row or column that was deleted after the formula was written
- The range being compared includes a cell with a
#DIV/0!or#VALUE!error from upstream
=IFERROR(EXACT(A2, B2), "Check for errors")
Since EXACT only propagates errors rather than generating unique ones of its own, IFERROR is safe to use broadly here. There's no reason to isolate a specific error type with IFNA the way you would with a lookup function.
Notes & Gotchas
What is the EXACT function in Excel and how does it work?
EXACT compares two text strings character by character and returns TRUE if they match exactly, FALSE if they don't. It checks every character, including spaces, punctuation, and letter case. Unlike most Excel comparisons, nothing about the match is approximate: one different character anywhere in the string produces FALSE.
Is the EXACT function in Excel case-sensitive?
Yes. This is EXACT's defining feature. "Report" and "report" return FALSE, even though every other letter in the string is identical. If case doesn't matter for your comparison, a plain =A2=B2 formula is simpler and does the job.
What is the difference between the EXACT function and the equal sign in Excel?
The equal sign ignores letter case entirely. =A2=B2 returns TRUE for "Yes" and "yes," while =EXACT(A2,B2) returns FALSE for the same pair. Use the equal sign for general comparisons and EXACT specifically when case needs to be enforced, such as password validation or code auditing.
How do you use the EXACT function to compare two columns in Excel?
Enter =EXACT(A2,B2) in a helper column and fill it down alongside your two columns. Each row returns TRUE or FALSE based on whether the corresponding cells match exactly, including case. Filter the results for FALSE to isolate every row that needs a closer look.
What does the EXACT function return if the text strings don't match exactly?
EXACT returns FALSE for any difference at all, whether it's a different letter, a different case, an extra space, or a missing character. It doesn't tell you where the mismatch is or how close the two strings are, only that they aren't identical. For partial matching or a similarity score, you'd need a different approach, like comparing string lengths with LEN or extracting substrings with MID.
Does EXACT ignore leading or trailing spaces?
No. A trailing space is a character like any other, and EXACT counts it. "Boston" and "Boston " will return FALSE even though they look identical in the cell. Wrap both arguments in TRIM if you want to ignore leading and trailing spaces: =EXACT(TRIM(A2), TRIM(B2)). A stray line break pasted in from another system causes the same kind of unexpected FALSE result, so if two values look identical but EXACT disagrees, check for any invisible character, not just a trailing space, before assuming the formula is broken.
How does EXACT handle numbers formatted differently, like 1 vs 1.0?
EXACT converts numbers to text before comparing, so the underlying value matters more than the display format. =EXACT(1, 1.0) returns TRUE because both values are numerically identical once converted to text, regardless of how many decimal places are displayed. Text that looks like a number, such as a product code stored as "007," compares based on its literal characters, so "007" and "7" return FALSE.
Can EXACT compare two lists regardless of order?
Not directly. EXACT compares position by position, so =EXACT(B2:E2, C2:F2) checks whether the first part number matches the first, the second matches the second, and so on down the row. It has no built-in way to tell you whether the same four part numbers on a bill of materials show up in both rows in a different sequence. For order-independent comparison, sort both lists first with SORT, or build a helper column that counts matches with COUNTIF instead of relying on EXACT alone.
Related Functions
| Function | Use this when... |
|---|---|
IF | You need to return a custom result based on whether EXACT finds a match. |
AND | You're checking whether every cell in a range matches exactly, not just one pair. |
OR | You only need to know if at least one of two or three cells matches, and case doesn't need array logic. |
TRIM | Leading or trailing spaces are causing EXACT to return FALSE on values that look identical. |
VLOOKUP | You need to find a value in a table rather than compare two known values directly. |
Related Functions
Excel CLEAN Function
CLEAN removes line breaks and control characters that sneak in when you copy data from databases, websites, or PDFs. Learn what it actually deletes, what it leaves behind, and why TRIM has to finish the job.
Excel CONCATENATE Function
CONCATENATE combines text from multiple cells into a single cell. It still works, but Microsoft recommends TEXTJOIN or CONCAT for anything new.
Excel FIND Function
FIND locates the position of one text string inside another, character by character. It's case-sensitive and doesn't support wildcards, which trips up a lot of people who reach for it expecting SEARCH-like flexibility.
Excel LEFT Function
LEFT pulls a specific number of characters from the beginning of a cell's text. It's the go-to function for splitting codes, IDs, and names apart without a formula that breaks the moment your data shifts.