Text function

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)
ArgumentWhat it means
text1RequiredThe first text or cell.
text2RequiredThe 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

C2fx=EXACT(A2,B2)
ABC
1Typed codeMaster code
2ab-12AB-12FALSE

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

C2fx=SUMPRODUCT(--EXACT(A2:A6,"AB-12"))
ABC
1Code
2AB-123
3ab-12
4AB-12
5Ab-12
6AB-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

D2fx=XLOOKUP(TRUE,EXACT(A2:A3,"AB-12"),B2:B3)
ABCD
1CodePrice
2ab-129.514
3AB-1214

Result: 14

EXACT produces {FALSE;TRUE}, so XLOOKUP looks for TRUE and returns the price on the second row.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 16 KB

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.

LanguageFunction name
CzechSTEJNÉ
DanishEKSAKT
DutchGELIJK
FinnishVERTAA
GermanIDENTISCH
HungarianAZONOS
ItalianIDENTICO
Norwegian (Bokmål)EKSAKT
PolishPORÓWNAJ
Portuguese (Brazil)EXATO
Portuguese (Portugal)EXATO
RussianСОВПАД
SpanishIGUAL
SwedishEXAKT
TurkishÖZDEŞ

Recipes that use EXACT