Excel EXACT Function
last modified October 5, 2026
The EXACT function is a text comparison function in Excel that
checks whether two text strings are identical, including case. It returns TRUE
when the strings match exactly and FALSE when they do not. Unlike the
= operator, EXACT distinguishes uppercase from
lowercase letters, which makes it valuable for quality control, validation,
and case-sensitive lookups. This tutorial covers the syntax, the differences
between EXACT and =, how numbers and whitespace are
handled, and common practical uses.
EXACT Function Basics
The EXACT function compares two text strings and returns TRUE if
they are exactly the same, and FALSE if they are not. The comparison is
case-sensitive, but it ignores formatting such as bold, color, or italic. Any
character difference, including a space, makes the result FALSE.
| Component | Description |
|---|---|
| Function Name | EXACT |
| Syntax | =EXACT(text1, text2) |
| Arguments | Two text strings to compare |
| Return Value | TRUE if identical, FALSE if different |
This table breaks down the essential components of the EXACT
function. It shows the function name, basic syntax format, argument
requirements, and return value characteristics.
| Argument | Meaning |
|---|---|
| text1 | The first text string. It can be a literal such as "Excel", a cell reference, or an expression that returns text. |
| text2 | The second text string to compare with text1, using the same forms. |
Both arguments are required. Supplying more than two produces a "too many arguments" error, and supplying fewer produces a "too few arguments" error. Non-text values are converted to text before the comparison, as explained below.
Basic EXACT Example
This example demonstrates the simplest use of the EXACT function with direct text comparisons.
=EXACT("Excel", "Excel") ' TRUE
=EXACT("Excel", "Excel ") ' FALSE, trailing space
The first formula compares two identical strings and returns TRUE. The second
adds a trailing space to the second string, so the two values are no longer
identical and EXACT returns FALSE.
EXACT Is Case-Sensitive
EXACT distinguishes uppercase from lowercase letters. This is the
key difference from an ordinary equality test.
| A | B | C |
|---|---|---|
| Excel | excel | =EXACT(A1,B1) |
| Word | word | =EXACT(A2,B2) |
| hello | hello | =EXACT(A3,B3) |
The table shows how EXACT handles case differences. The first two
rows return FALSE because a single capital letter differs, even though the
letters are otherwise the same. The third row returns TRUE because the two
strings match character for character.
=EXACT("hello", "hello") ' TRUE
=EXACT("hello", "HELLO") ' FALSE
=EXACT("Word", "word") ' FALSE
=EXACT("", "") ' TRUE, two empty strings match
Two empty strings are considered identical, so =EXACT("","")
returns TRUE. Because EXACT compares the actual characters
literally, locale-specific case rules do not change its result: "i" and "I"
are always different, no matter which regional settings are in use.
EXACT vs the = Operator
The = operator also compares two values, but it is
case-insensitive. That means ="Apple"="apple" returns TRUE, while
=EXACT("Apple","apple") returns FALSE.
| Formula | Result |
|---|---|
| ="Apple"="apple" | TRUE |
| =EXACT("Apple","apple") | FALSE |
| ="Word"="word" | TRUE |
| =EXACT("Word","word") | FALSE |
The table contrasts the two comparisons. Use = when case does not
matter, and EXACT when it does. Because EXACT returns
an array of TRUE/FALSE values when it is given a range, it is often paired
with SUMPRODUCT to count case-sensitive matches:
=SUMPRODUCT(--EXACT(A1:A10, "apple"))
This formula counts how many cells in A1:A10 contain exactly "apple" in
lowercase. Cells containing "Apple" or "APPLE" are not counted. The double
unary minus converts the TRUE/FALSE array into 1s and 0s that
SUMPRODUCT can add.
EXACT with Numbers and Text
EXACT is designed for text, but it accepts numbers and other
values by converting them to text first. A number and its text equivalent are
therefore treated as identical.
| Formula | Result |
|---|---|
| =EXACT(100, "100") | TRUE |
| =EXACT(1, 1) | TRUE |
| =EXACT(1, "1") | TRUE |
| =EXACT(1, "1.0") | FALSE |
| =EXACT(TRUE, "TRUE") | TRUE |
The table shows that the number 100 and the text "100" compare as equal, because the number is converted to the text "100" before the comparison. The same happens for the logical value TRUE, which converts to the text "TRUE". The fourth row returns FALSE because "1.0" keeps its trailing zero as text and does not match the converted number "1".
=EXACT(100, "100") ' TRUE =EXACT(1, "1.0") ' FALSE =EXACT(TRUE, "TRUE") ' TRUE
A number is converted using its underlying value, not the way it is displayed.
A cell holding the number 1000 formatted with a thousands separator still
converts to "1000", so =EXACT(A1,"1,000") returns FALSE. To
compare displayed text instead, convert the number with the TEXT
function first, for example =EXACT(TEXT(A1,"#,##0"),"1,000").
EXACT with Whitespace
EXACT compares every character, so spaces matter. Leading,
trailing, and repeated spaces all cause the comparison to fail. This is a
common source of unexpected FALSE results in imported data.
| A | B | C |
|---|---|---|
| Data | Data | =EXACT(A1,B1) |
| a b | a b | =EXACT(A2,B2) |
| a b | a b | =EXACT(A3,B3) |
The first row returns FALSE because B1 has a trailing space. The second row returns TRUE because the single spaces match. The third row returns FALSE because A3 contains two spaces between the letters while B3 contains one.
=EXACT(TRIM(A1), TRIM(B1))
TRIM removes leading and trailing spaces and collapses internal
runs of spaces to one, so this formula compares the meaningful text. Note that
TRIM does not remove the non-breaking space created by
CHAR(160); use SUBSTITUTE(A1,CHAR(160)," ") first in
that case.
EXACT with Data Validation
EXACT can power a data validation rule that requires an exact,
case-sensitive entry. In Excel, choose Data, then Data Validation, set Allow to
Custom, and enter a formula that returns TRUE for valid input.
=EXACT(B1, "YES")
This rule accepts only "YES" in uppercase. Entries such as "yes", "Yes", or
"YES " are rejected. A more flexible rule allows any text as long as it is
already uppercase, using =AND(EXACT(B1,UPPER(B1)),ISTEXT(B1)).
EXACT for Duplicate Detection
Because EXACT is case-sensitive, it can find duplicates that a
plain COUNTIF would miss. A standard COUNTIF treats
"apple" and "APPLE" as the same value, while EXACT keeps them
separate.
| A | B |
|---|---|
| apple | =SUMPRODUCT(--EXACT($A$1:$A$5,A1))>1 |
| Apple | |
| apple | |
| banana | |
| APPLE |
Copied down column B, the formula returns TRUE for the two lowercase "apple"
cells in rows 1 and 3, and FALSE for "Apple", "banana", and "APPLE". The
absolute range $A$1:$A$5 keeps the list fixed as the formula
fills down.
EXACT in Conditional Formatting
A conditional formatting rule can use EXACT to highlight cells
that match a value with the correct case. Select the range, create a new rule
with a formula, and enter the comparison.
| A | B |
|---|---|
| Approved | APPROVED |
| Rejected | rejected |
=EXACT($A1, "Approved")
This rule highlights cells in column A that match "Approved" exactly. Only the
first row qualifies, because "APPROVED" differs in case and "rejected" is a
different word. The mixed reference $A1 locks the column while
letting the row change, which is the usual pattern for a whole-column rule.
EXACT, FIND, and SEARCH
EXACT is not the only case-aware text function. FIND
is case-sensitive and SEARCH is case-insensitive, but both return
the position of one string inside another rather than TRUE or FALSE.
| Formula | Result |
|---|---|
| =FIND("b","abc") | 2 |
| =FIND("B","abc") | #VALUE! |
| =SEARCH("B","abc") | 2 |
Use EXACT when you need a TRUE/FALSE answer for two complete
strings. Use FIND or SEARCH when you need the
location of a substring, and remember that SEARCH also accepts
the wildcards ? and *.
EXACT Errors and Troubleshooting
| Cause | Symptom | Fix |
|---|---|---|
| More than two arguments | Too many arguments error | EXACT accepts exactly two arguments |
| One argument is an error value | The same error is returned | Clean the source with IFERROR before comparing |
| Trailing or repeated spaces | FALSE for values that look equal | Wrap both arguments in TRIM, or remove CHAR(160) |
| Number compared with formatted text | FALSE, for example 1000 versus "1,000" | Convert with TEXT, or compare the numbers directly |
| Case-insensitive match expected | FALSE for "Apple" versus "apple" | Use the = operator, or LOWER/UPPER on both sides |
| A range is passed in legacy Excel | One result or #VALUE! instead of a list | Wrap it in SUMPRODUCT, or confirm with Ctrl+Shift+Enter |
The EXACT function is the tool of choice for precise,
case-sensitive text comparisons in Excel. It returns a simple TRUE or FALSE,
converts non-text values to text, and ignores formatting while honoring every
character, including spaces. Knowing how it differs from the =
operator, FIND, and SEARCH lets you choose the right
comparison for validation, duplicate detection, conditional formatting, and
case-sensitive lookups. Mastering EXACT will make your text
formulas more accurate and predictable.
Author
List all Excel Formulas.