# How to do a case-sensitive count in Excel

COUNTIF ignores case, so use EXACT inside SUMPRODUCT: `=SUMPRODUCT(--EXACT(B2:B10,E1))` counts only cells that match E1 letter for letter.

**Excel:** `=SUMPRODUCT(--EXACT(B2:B10,E1))` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| Order | Coupon |  | Code | SAVE10 |
| W-301 | SAVE10 |  | Exact matches |  |
| W-302 | save10 |  |  |  |
| W-303 | WELCOME |  |  |  |
| W-304 | SAVE10 |  |  |  |
| W-305 | Save10 |  |  |  |
| W-306 | FREESHIP |  |  |  |
| W-307 | SAVE10 |  |  |  |
| W-308 | save10 |  |  |  |
| W-309 | WELCOME |  |  |  |

Formula in E2: `=SUMPRODUCT(--EXACT(B2:B10,E1))`

Result: 3

## How it works

EXACT compares two texts and returns TRUE only when every character matches, case included. Given the whole column, it returns one TRUE or FALSE per row; the double minus turns those into 1s and 0s, and SUMPRODUCT adds them up.

Only three orders used "SAVE10" in capitals. COUNTIF would report six, because to it "save10" and "Save10" are the same code.

## Other ways

- `=SUMPRODUCT(--ISNUMBER(FIND(E1,B2:B10)))`: Case-sensitive "contains": FIND, unlike SEARCH, respects case. Use it when the code can be part of a longer text.
- `=COUNTIF(B2:B10,E1)`: The usual count, which ignores case. (Counts all six variants of the code.)

## Common mistakes

- COUNTIF, COUNTIFS, MATCH and XLOOKUP all ignore case. Only EXACT and FIND tell "SAVE10" from "save10".
- EXACT also compares spaces, so "SAVE10 " with a trailing space does not match. Wrap the range in TRIM if the data is messy.

## Questions

**How do I add another condition to a case-sensitive count?**

Multiply the tests: `=SUMPRODUCT(EXACT(B2:B10,E1)*(A2:A10<>""))`.

**Is there a case-sensitive COUNTIF in Google Sheets?**

Not directly, but the same SUMPRODUCT and EXACT formula works, and so does `=SUMPRODUCT(--REGEXMATCH(B2:B10,"^"&E1&"$"))`, since REGEXMATCH is case-sensitive.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/case-sensitive-count
