# EXACT function in Excel

> EXACT compares two text values and returns TRUE only if they match exactly, including upper and lower case.

Source: https://spreadsheetpractice.com/functions/exact · Updated October 28, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

## Quick answer

- **What it does:** EXACT compares two text values and returns TRUE only if they match exactly, including upper and lower case.
- **Syntax:** `=EXACT(text1, text2)`
- **Most common use:** `=EXACT(A2,B2)` returns TRUE (Same characters, same case: TRUE)
- **Available in:** Every current version
- **Category:** [Text functions](https://spreadsheetpractice.com/functions/category/text)
- **Returns:** TRUE if the two match character for character, otherwise FALSE.
- **Google Sheets:** Works the same in Google Sheets.

## What it does

EXACT compares two text values and returns TRUE only if they match exactly, including upper and lower case. The = sign and lookups ignore case, so EXACT is what you use when case matters, such as for case-sensitive product codes or IDs.

## Syntax

`=EXACT(text1, text2)`

| Argument | Required? | What it is |
|---|---|---|
| `text1` | Required | The first text or cell. |
| `text2` | Required | The text or cell to compare it with. |

## Examples

Each result was calculated by running the formula on the sample sheet.

| Cell | Formula | Result | What it shows |
|---|---|---|---|
| C2 | `=EXACT(A2,B2)` | TRUE | Same characters, same case: TRUE |
| C3 | `=EXACT(A3,B3)` | FALSE | Same letters, different case: FALSE |
| C4 | `=EXACT(A4,B4)` | FALSE | A trailing space makes them different |

### The sample sheet

Every formula above runs on this data:

|  | A | B | C |
|---|---|---|---|
| 1 | Code on file | Code entered | Result |
| 2 | ABc-12 | ABc-12 | TRUE |
| 3 | ABc-12 | abc-12 | FALSE |
| 4 | XR-7 | XR-7 | FALSE |

## Common mistakes

| What you see | Why, and how to fix it |
|---|---|
| Spaces cause FALSE | EXACT counts every space. Compare TRIM(A2) with TRIM(B2) when spacing shouldn't matter. |
| Numbers compare as text | EXACT converts both values to text, so EXACT(100,"100") is TRUE even though =100="100" is FALSE. |

## Tips

- For a case-sensitive lookup, combine it with XLOOKUP: =XLOOKUP(TRUE,EXACT(A2:A20,D2),B2:B20).

## Related functions

- [FIND](https://spreadsheetpractice.com/functions/find): FIND returns the position of one piece of text inside another, counting from 1.
- [XLOOKUP](https://spreadsheetpractice.com/functions/xlookup): XLOOKUP searches one column or row for a value and returns the matching item from another.
- [TRIM](https://spreadsheetpractice.com/functions/trim): TRIM removes spaces from the start and end of text and shrinks runs of spaces between words to one.

## Questions

### How do I compare two cells with a case-sensitive match?

=EXACT(A2,B2) returns TRUE only when the text and the case both match. =A2=B2 ignores case.

### Is Excel case-sensitive?

Mostly no: the = sign, VLOOKUP, XLOOKUP, MATCH and COUNTIF all ignore case. EXACT, FIND and SUBSTITUTE are case-sensitive.

## Practice

A graded EXACT exercise ("Case-sensitive code check") is on [the EXACT page](https://spreadsheetpractice.com/functions/exact). It is checked instantly, then re-checked on changed data.

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
