Catch typos and rogue entries by flagging anything that isn’t in your approved list — a misspelled department, an invalid code. COUNTIF against the master list returns zero for unknowns.
The example
"Saless" isn’t a valid department.
| A | B | |
|---|---|---|
| 1 | Entry | Check |
| 2 | Sales | OK |
| 3 | Saless | Invalid |
The formula
The formula:
How it works
How it works:
COUNTIF(allowed_list, A2)counts the entry in the master list — 0 means unrecognized.- Wrap in
IFto flag Invalid for cleanup or rejection. - It’s the formula counterpart to a data-validation dropdown — useful for auditing data already entered.
- Normalize with
TRIM/UPPERfirst so case and spacing don’t cause false flags.
Validate after the fact. Data validation stops bad entries going forward, but it doesn’t fix the thousand rows already in the file. A COUNTIF-against-master flag audits the existing data, surfacing every value that slipped in before the rules existed — the cleanup companion to a validation list.
Try it: interactive demo
Entry and allowed list.
Variations
Count invalids
How many bad:
Case-insensitive key
Normalize first:
Closest match (365)
Suggest a fix:
Pitfalls & errors
Both must be normalized. Apply the same TRIM/UPPER to the list and the entry.
Wildcards in COUNTIF. Values with * or ? need escaping — rare but real.
Blanks. Empty cells count as not-in-list — decide if that’s “Invalid” or skipped.
Practice workbook
Frequently asked questions
How do I find values not in an allowed list in Excel?
How is this different from data validation?
How do I avoid false flags from case or spaces?
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