ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before the interview. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Text
  3. Case-Sensitive Matching in Excel With EXACT

Case-Sensitive Matching in Excel With EXACT

By ExcelReady Team·Updated October 30, 2026·6 min read

The short answer

EXACT compares two values and returns TRUE only when they match character for character, capitals included: =EXACT(A2,B2). The equals sign, VLOOKUP, XLOOKUP and COUNTIF all ignore case, so "ab-1" and "AB-1" count as the same. Use EXACT inside IF, SUMPRODUCT or XLOOKUP when capitals matter.

Key takeaways

  • =EXACT(text1, text2) returns TRUE only for an identical match, capitals included.
  • A plain = comparison, VLOOKUP, XLOOKUP, MATCH and COUNTIF all ignore capitals.
  • EXACT notices extra spaces, so clean the data with TRIM first.
  • Count case-sensitive matches with =SUMPRODUCT(--EXACT(range,value)).
  • Look up case-sensitively with =XLOOKUP(TRUE,EXACT(range,value),return_range).
On this page+
  1. What does EXACT do in Excel?
  2. Why = and VLOOKUP aren't case-sensitive
  3. How to use EXACT to check typed values
  4. How to use EXACT inside IF
  5. How to count case-sensitive matches
  6. How to do a case-sensitive lookup
  7. How to find duplicates that differ only in case
  8. Case-sensitive search inside text: FIND vs SEARCH
  9. Common mistakes with EXACT
  10. Practise it

The Excel EXACT function compares two values and returns TRUE only when they are identical, capital letters included. Most of Excel ignores case: ="ab-1"="AB-1" is TRUE, and VLOOKUP treats them as the same code. This guide shows how to use EXACT on its own, inside IF, and in case-sensitive counts and lookups, for anyone working with codes, passwords-style IDs or SKUs where capitals carry meaning.

What does EXACT do in Excel?#

EXACT checks whether two texts match character for character and returns TRUE or FALSE.

Excel formula
=EXACT(text1, text2)
FormulaResultWhy
=EXACT("AB-1042","AB-1042")TRUEIdentical
=EXACT("AB-1042","ab-1042")FALSEDifferent capitals
="AB-1042"="ab-1042"TRUE= ignores case
=EXACT("DL-0375","DL-0375 ")FALSETrailing space
=EXACT(5,"5")TRUEBoth become the text "5"

EXACT works in every version of Excel. It ignores formatting such as bold or colour, but it doesn't ignore spaces.

Why = and VLOOKUP aren't case-sensitive#

Excel's normal comparisons treat capital and small letters as equal. This is usually helpful: "Leeds", "LEEDS" and "leeds" should all count as the same city. The comparison operators guide covers how =, <> and the others work on text.

The functions that rely on those comparisons ignore case too:

  • the = and <> operators;
  • VLOOKUP, HLOOKUP, XLOOKUP and MATCH;
  • COUNTIF, SUMIF and their IFS versions.

That becomes a problem when capitals carry meaning, as in product codes where "AB" and "ab" are different items, or in case-sensitive system IDs. EXACT is the tool for those cases.

How to use EXACT to check typed values#

Compare each typed value with the master value to find entries in the wrong case:

ABC
1Master codeTyped codeExact match?
2AB-1042ab-1042FALSE
3CX-2210CX-2210TRUE
4DL-0375DL-0375␣FALSE
5PR-8810Pr-8810FALSE

In C2, type =EXACT(A2,B2) and fill down with Ctrl+D (Windows) or ⌘D (Mac). Row 4 fails because of a trailing space (shown as ␣), not the capitals. If spaces shouldn't count, compare =EXACT(TRIM(A4),TRIM(B4)) instead.

How to use EXACT inside IF#

EXACT returns TRUE or FALSE, so it fits straight into the test of an IF. The IF function guide explains the three parts.

Excel formula
=IF(EXACT(A2,B2),"OK","Check case")

This shows "OK" for an exact match and "Check case" for anything else. You can also check that a cell is all capitals by comparing it with its own UPPER version:

Excel formula
=IF(EXACT(A2,UPPER(A2)),"OK","Use capitals")

For "Pr-8810" this returns "Use capitals". The same test works as a data validation rule: select the cells starting from A2, choose Data > Data Validation, set Allow to Custom, and enter =EXACT(A2,UPPER(A2)) as the formula. Excel then rejects any entry that isn't in capitals. Our IF function article has more ways to turn a TRUE/FALSE test into a message.

How to count case-sensitive matches#

COUNTIF ignores case, so use SUMPRODUCT with EXACT:

Excel formula
=SUMPRODUCT(--EXACT(A2:A10,"AB-1042"))

How it works:

  1. EXACT(A2:A10,"AB-1042") checks every cell and returns a list of TRUE and FALSE.
  2. The double minus -- turns TRUE into 1 and FALSE into 0.
  3. SUMPRODUCT adds the 1s.

If the range holds "AB-1042" twice and "ab-1042" once, COUNTIF returns 3 but this formula returns 2. SUMPRODUCT works in every version of Excel without Ctrl+Shift+Enter.

How to do a case-sensitive lookup#

Ask XLOOKUP to find the first TRUE in a list of EXACT results:

Excel formula
=XLOOKUP(TRUE,EXACT(A2:A6,E2),B2:B6)

EXACT compares E2 with every code in A2:A6 and returns TRUE only where the case matches. XLOOKUP then finds that TRUE and returns the value from B2:B6 on the same row. XLOOKUP needs Excel 2021, Excel 2024 or Microsoft 365.

In older versions, use INDEX and MATCH the same way:

Excel formula
=INDEX(B2:B6,MATCH(TRUE,EXACT(A2:A6,E2),0))

In Excel 2019 and older, confirm this one as an array formula with Ctrl+Shift+Enter, because it handles a whole range inside MATCH. In Excel 2021, Excel 2024 and Microsoft 365 a normal Enter is enough.

How to find duplicates that differ only in case#

COUNTIF can't tell "AB-1042" from "ab-1042", so a normal duplicate check counts them as the same code. To flag only true, case-exact duplicates, count each value with EXACT against the whole column:

Excel formula
=SUMPRODUCT(--EXACT($A$2:$A$10,A2))>1

Fill it down next to the list. It returns TRUE when the exact same text, capitals included, appears more than once. Compare it with =COUNTIF($A$2:$A$10,A2)>1: rows where COUNTIF says TRUE but this formula says FALSE are codes that clash only by case, which are worth checking by hand.

Case-sensitive search inside text: FIND vs SEARCH#

EXACT compares whole values. To check whether a cell contains some text with the right capitals, use FIND, which is case-sensitive. SEARCH is the version that ignores case.

Excel formula
=ISNUMBER(FIND("AB",A2))

This returns TRUE if A2 contains a capital "AB" anywhere. With SEARCH it would also match "ab". Our guide to FIND and SEARCH explains the differences, including wildcards. SUBSTITUTE is case-sensitive too, which matters when you swap text with SUBSTITUTE and REPLACE.

Common mistakes with EXACT#

These are the problems you're most likely to hit:

  • Hidden spaces. EXACT says FALSE although the values look the same. Check with =LEN(A2) and clean with TRIM.
  • Numbers and dates. EXACT compares numbers as text, so a date compared with a typed date string usually fails. Compare dates with = instead.
  • Using EXACT with a range on its own. =EXACT(A2:A10,"AB-1") returns a list. In Microsoft 365 it spills a column of TRUE/FALSE; wrap it in SUMPRODUCT, OR or XLOOKUP to get a single answer.
  • Expecting COUNTIF to be case-sensitive. It never is. Use the SUMPRODUCT pattern.

Practise it#

Try the live exercise above. Then practise case-sensitive and case-insensitive searching in the FIND and SEARCH lesson, and see how Excel's comparisons treat capitals in the TRUE, FALSE and comparisons lesson.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Product codes must be typed in the exact case shown in the master list. In C2, use EXACT to check whether the code typed in B2 matches the master code in A2.

fx
ABCD
1
Master code
Typed code
Exact match?
2
AB-1042
ab-1042
3
CX-2210
CX-2210
4
DL-0375
DL-0375
5
PR-8810
Pr-8810
6
7
8

Tip: EXACT takes the two values to compare, separated by a comma.

Practise this in a lesson

LessonFIND and SEARCHLocate a character or word inside text with FIND or SEARCH, then use that position to split names and pull out order numbers.LessonTRUE, FALSE and comparisonsAsk Excel yes-or-no questions with =, <>, >, <, >= and <=, and get TRUE or FALSE back. The building block of every IF.Function guideIFLearn Excel's IF function with practical examples: flag budgets, label rows and return blanks. Avoid the classic mistakes and practice live.

Frequently asked questions

Is the equals sign case-sensitive in Excel?

+

No. ="abc"="ABC" returns TRUE. Use =EXACT("abc","ABC") for a case-sensitive comparison, which returns FALSE.

Is VLOOKUP case-sensitive?

+

No. VLOOKUP, XLOOKUP, MATCH and COUNTIF all treat capital and small letters as the same. Combine XLOOKUP or INDEX MATCH with EXACT for a case-sensitive lookup.

Does EXACT ignore formatting?

+

Yes. EXACT compares the values, not bold, colour or number formats. It does notice spaces, so "abc" and "abc " are different.

How do I count case-sensitive matches in Excel?

+

Use =SUMPRODUCT(--EXACT(A2:A10,"AB-1")). EXACT returns TRUE or FALSE for each cell, the double minus turns them into 1s and 0s, and SUMPRODUCT adds them.

Sources

  • EXACT function - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What does EXACT do in Excel?
  2. Why = and VLOOKUP aren't case-sensitive
  3. How to use EXACT to check typed values
  4. How to use EXACT inside IF
  5. How to count case-sensitive matches
  6. How to do a case-sensitive lookup
  7. How to find duplicates that differ only in case
  8. Case-sensitive search inside text: FIND vs SEARCH
  9. Common mistakes with EXACT
  10. Practise it

Keep reading

Text· 6 min read

REPT in Excel: Simple In-Cell Bar Charts

REPT repeats text a number of times: =REPT("|",5) returns |||||. To draw an in-cell bar chart, repeat a character in proportion to each value, such as =REPT("|",B2/1000) for one bar per 1,000. Scale long bars with =REPT("|",ROUND(B2/MAX($B$2:$B$7)*20,0)) so the largest value gets 20 characters.

Text· 8 min read

SUBSTITUTE and REPLACE in Excel

Use SUBSTITUTE when you know the text you want to change: =SUBSTITUTE(A2,".","-") swaps every dot for a dash. Use REPLACE when you know the position: =REPLACE(A2,1,3,"XXX") overwrites the first three characters. SUBSTITUTE is case-sensitive and can change just one occurrence; REPLACE ignores what the characters say.

Logic· 6 min read

The Excel IF Function Explained Simply

The Excel IF function checks a condition and returns one value when it's TRUE and another when it's FALSE. The syntax is =IF(logical_test, value_if_true, value_if_false). For example, =IF(B2>=70,"Pass","Fail") shows Pass for a score of 70 or more and Fail for anything lower. Text results go in double quotes.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free