EXACT function
Compares two text strings and returns TRUE only if they are identical, including upper and lower case.
Available in All versions of Excel, including Microsoft 365, Excel for Mac and Excel for the web
In every Excel versionWorks in Google Sheets
Syntax
EXACT(text1, text2)| Argument | What it means | |
|---|---|---|
text1 | Required | The first text or cell. |
text2 | Required | The second text or cell. |
Returns: TRUE if the two strings match character for character, otherwise FALSE.
How EXACT works
The normal = comparison in Excel ignores case: ="abc"="ABC" returns TRUE. Most of the time that is helpful, but sometimes case matters - product codes where ab-12 and AB-12 are different items, passwords, or case-sensitive IDs from another system. EXACT compares character by character, case included, and returns TRUE only for a perfect match.
EXACT ignores cell formatting (bold, colours, number formats) but does notice spaces, so "Ana " and "Ana" are different. Numbers are compared as their text form. Because EXACT works on arrays, you can use it inside SUMPRODUCT or FILTER for case-sensitive counting and lookups, something COUNTIF and VLOOKUP cannot do.
Examples
1Check a product code against the master
| A | B | C | |
|---|---|---|---|
| 1 | Typed code | Master code | |
| 2 | ab-12 | AB-12 | FALSE |
Result: FALSE
The letters are the same but the case is not, so EXACT returns FALSE. A plain =A2=B2 would have said TRUE.
2Case-sensitive count
| A | B | C | |
|---|---|---|---|
| 1 | Code | ||
| 2 | AB-12 | 3 | |
| 3 | ab-12 | ||
| 4 | AB-12 | ||
| 5 | Ab-12 | ||
| 6 | AB-12 |
Result: 3
EXACT returns TRUE/FALSE for each cell; -- turns them into 1/0 and SUMPRODUCT adds them. Only the three all-capital codes count.
3Case-sensitive lookup
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Code | Price | ||
| 2 | ab-12 | 9.5 | 14 | |
| 3 | AB-12 | 14 |
Result: 14
EXACT produces {FALSE;TRUE}, so XLOOKUP looks for TRUE and returns the price on the second row.
Tips
- Combine with TRIM when stray spaces should not count:
=EXACT(TRIM(A2),TRIM(B2)). - To check that a whole column has been typed in capitals:
=AND(EXACT(A2:A50,UPPER(A2:A50))).
Google Sheets
EXACT also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
EXACT in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Czech | STEJNÉ |
| Danish | EKSAKT |
| Dutch | GELIJK |
| Finnish | VERTAA |
| German | IDENTISCH |
| Hungarian | AZONOS |
| Italian | IDENTICO |
| Norwegian (Bokmål) | EKSAKT |
| Polish | PORÓWNAJ |
| Portuguese (Brazil) | EXATO |
| Portuguese (Portugal) | EXATO |
| Russian | СОВПАД |
| Spanish | IGUAL |
| Swedish | EXAKT |
| Turkish | ÖZDEŞ |