Google Sheets function · Text
EXACT in Google Sheets: syntax and examples
EXACT returns TRUE only when both texts match character by character, with the same case. The = operator ignores case, so use EXACT for passwords, codes and any comparison where A and a are different.
Syntax
EXACT(string1, string2)
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
string1 | string | yes | The first text. |
string2 | string | yes | The second text, compared with string1. |
Examples
The examples use this table, starting in A1:
| Code | Typed |
| AB-1 | AB-1 |
| ab-1 | AB-1 |
| AB-1 | AB-1 |
| Zebra | Zebra |
=EXACT(A2,B2)Result: TRUE
Identical texts return TRUE.
Run in a Google Sheet (English US locale) on .
=EXACT(A3,B3)Result: FALSE
Only the case differs and the result is FALSE.
Run in a Google Sheet (English US locale) on .
=A3=B3Result: TRUE
For contrast: the equals operator ignores case, so this is TRUE.
Run in a Google Sheet (English US locale) on .
=EXACT(A4,B4)Result: FALSE
A trailing space makes the texts different.
Run in a Google Sheet (English US locale) on .
=EXACT(TRIM(A4),B4)Result: TRUE
TRIM removes the extra space, then the texts match.
Run in a Google Sheet (English US locale) on .
Common errors
- EXACT is case sensitive, while = is not. "ab-1" = "AB-1" is TRUE, but EXACT on the same pair is FALSE.
- Invisible differences count. A trailing space makes the pair FALSE. Wrap one side in TRIM, as in the examples.
- A range in a plain formula returns #VALUE!. Use ARRAYFORMULA to compare two columns row by row.
- A number and the same digits as text are equal: EXACT(123,"123") is TRUE.
Compared with Excel
Same syntax in Excel.