VLOOKUP and XLOOKUP ignore case — “abc” matches “ABC.” When case matters (an ID like aB12 vs Ab12), pair EXACT with INDEX/MATCH to force an exact, case-sensitive match.
The example
Two keys differ only in case. We look up aB12.
| A | B | D | E | ||
|---|---|---|---|---|---|
| 1 | Code | Price | Lookup | Price | |
| 2 | AB12 | $10 | aB12 | $25 | |
| 3 | aB12 | $25 | |||
| 4 | Ab12 | $40 |
The formula
The case-exact price:
How it works
EXACT is what makes it case-sensitive:
EXACT(A2:A4, "aB12")compares every code to the lookup value respecting case, producing {FALSE, TRUE, FALSE}.MATCH(TRUE, …, 0)finds the position of the TRUE — row 2.INDEX(B2:B4, …)returns the price on that row —$25.- A plain VLOOKUP would have grabbed the first “ab12”-ish match regardless of case.
Array entry in old Excel. Because EXACT returns an array, Excel 2019 and earlier need this entered with Ctrl+Shift+Enter. Excel 365 and 2021 handle it natively.
Try it: interactive demo
Pick which exact-case code to look up.
Variations
Case-sensitive XLOOKUP (365)
Feed XLOOKUP an EXACT array:
Case-sensitive count
How many cells exactly match:
Two-key case-sensitive match
Multiply EXACT arrays:
Pitfalls & errors
VLOOKUP/XLOOKUP/MATCH are case-insensitive. None of them distinguish case on their own — EXACT is the only built-in case-sensitive comparison.
Old Excel needs Ctrl+Shift+Enter. The EXACT array won’t evaluate correctly as a normal formula before Excel 2021.
Trailing spaces still bite. EXACT also treats “aB12 ” (trailing space) as different. TRIM if needed.
Practice workbook
Frequently asked questions
How do I do a case-sensitive lookup in Excel?
Why does VLOOKUP ignore case?
Can XLOOKUP be case-sensitive?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class