Category: FUNCTION | Updated: 2026-11-22

How to Use the EXACT Function in Google Sheets | Case-Sensitive Exact String Comparison

How to Use the EXACT Function

The EXACT function is a text function that compares two strings to determine whether they are completely identical—including case (uppercase vs. lowercase) and character width (full-width vs. half-width)—returning TRUE if they match and FALSE otherwise. It is ideal for verifying passwords, serial codes, and strict data differences before and after migrations.

Syntax

=EXACT(string1, string2)
  • string1: The first string or cell reference to compare (required).
  • string2: The second string or cell reference to compare (required).

Examples

Here is an example verifying whether input data (Column B) exactly matches master codes (Column A), including case sensitivity.

Row Column A (Master Code) Column B (Input Data) Column C (EXACT Check) Column D (Ref: =A2=B2)
1 Master Code Input Data EXACT Result Standard Comparison
2 Abc-123 Abc-123 =EXACT(A2, B2) → TRUE TRUE
3 Abc-123 abc-123 =EXACT(A3, B3) → FALSE TRUE
4 XYZ_99 XYZ_99 =EXACT(A4, B4) → FALSE FALSE
  • Formula: =EXACT(A3, B3)
  • Result: FALSE

As shown in row 3, case differences that a normal = comparison treats as TRUE are accurately flagged as mismatches (FALSE) by EXACT.

Common Errors and Tips

  • Formatting differences (fonts, colors) are ignored: EXACT only compares the underlying text content. Visual formatting such as font color, bolding, background color, or number format does not affect the result.
  • Numbers and numeric strings may be treated as equal: Comparing the number 123 with the text string "123" returns TRUE because both are evaluated as text internally. Use the TYPE function if you also need to distinguish data types.
  • Invisible trailing spaces return FALSE: As in row 4, even a single trailing space causes FALSE. If you want to ignore leading or trailing spaces, use =EXACT(TRIM(A2), TRIM(B2)).

Frequently Asked Questions

Q. What is the difference between EXACT and a standard equals comparison (=A2=B2)?

A. A standard "=A2=B2" comparison is case-insensitive, so "ABC" and "abc" evaluate to TRUE. In contrast, "=EXACT("ABC", "abc")" returns FALSE because EXACT strictly distinguishes uppercase and lowercase letters.

Q. Does EXACT distinguish between full-width and half-width characters?

A. Yes. Full-width "ABC" and half-width "ABC", as well as full-width and half-width spaces, are treated as different characters and return FALSE.