ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

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

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Logic
  3. Data Quality Checks in Excel: Formulas That Flag Bad Rows

Data Quality Checks in Excel: Formulas That Flag Bad Rows

By ExcelReady Team·Updated November 3, 2026·6 min read

The short answer

Data quality checks in Excel are formulas that test each row and flag problems before you analyse the data. Use ISNUMBER to catch numbers stored as text, COUNTIF to find duplicate IDs, LEN to check lengths and spaces, and a blank test for missing values. Combine them with AND inside IF to show OK or Check on every row.

Key takeaways

  • Test one rule per formula first, then combine the rules with AND inside IF for a single status column.
  • ISNUMBER(D2) is FALSE for a number stored as text, which SUM and SUMIF quietly skip.
  • COUNTIF($A$2:$A$7,A2)>1 flags every row whose ID appears more than once.
  • LEN checks fixed-length codes, and LEN(B2)<>LEN(TRIM(B2)) catches extra spaces.
  • Count the flagged rows at the top of the sheet so problems can't hide below the fold.
On this page+
  1. Why run data quality checks before you analyse?
  2. Check for blanks and missing values
  3. Check for numbers stored as text with ISNUMBER
  4. Find duplicate IDs with COUNTIF
  5. Check lengths, spaces and formats with LEN
  6. Combine the checks into one status column
  7. Prevent bad data at the source
  8. Practise it

Data quality checks in Excel are simple formulas that test every row and flag the ones that would break your analysis: blanks, numbers stored as text, duplicate IDs, codes of the wrong length and stray spaces. You write one test per rule, then combine them into a status column that says OK or Check. This guide is for analysts, admins and anyone who receives exports and imports and needs to trust the numbers before building a report.

Why run data quality checks before you analyse?#

Bad rows rarely cause an error message. They cause wrong answers. A number stored as text is skipped by SUM, a duplicate ID is counted twice, and "North " with a trailing space is missed by COUNTIF. The total looks fine and is wrong.

A checks column catches these problems in seconds and keeps working when new data is pasted in. All examples use this customer list in A1:D7:

ABCD
1IDCustomerEmailAmount
2C-1001Ana Ruizana@example.com250
3C-1002Ben Coleben@example.com180 (stored as text)
4C-1003chloe@example95
5C-1004Dev Shahdev@example.com410
6C-1002Ben Coleben@example.com180
7C-105Ema Lund (with a leading space)ema@example.com−20

Every row except 2 and 5 has at least one problem. The formulas below find them all.

Check for blanks and missing values#

A missing value is the easiest problem to test. For one cell, use ISBLANK or compare with empty text:

Excel formula
=ISBLANK(B4)
=B4=""

Both return TRUE for row 4, where the customer name is missing. The difference: ISBLANK is FALSE for a cell that holds a formula returning "", while B4="" is TRUE for both. For a count, =COUNTBLANK(B2:B7) returns 1. The guide to ISBLANK, ISNUMBER and ISTEXT explains why a cell that looks empty can still fail ISBLANK.

Check for numbers stored as text with ISNUMBER#

A number stored as text looks normal but behaves like a word. ISNUMBER catches it:

Excel formula
=ISNUMBER(D3)

This returns FALSE for row 3, because 180 was imported as text. Real numbers, including negatives, return TRUE. To count the bad cells in a column, subtract the numbers from all filled cells:

Excel formula
=COUNTA(D2:D7)-COUNT(D2:D7)

The result is 1. The ISNUMBER function guide covers the details. To fix the values, use Data > Text to Columns > Finish on the column, or VALUE in a helper column. The guide to cleaning messy data in Excel walks through both.

Find duplicate IDs with COUNTIF#

An ID should appear once. COUNTIF counts how many times each ID appears in the whole column:

Excel formula
=COUNTIF($A$2:$A$7,A2)>1

Fill it down. Rows 3 and 6 return TRUE, because C-1002 appears twice. The $ signs lock the range so it doesn't shift as you fill (press F4 on Windows or ⌘T on a Mac to add them). To count how many rows share an ID, use =SUMPRODUCT(--(COUNTIF(A2:A7,A2:A7)>1)), which returns 2. The COUNTIF function guide covers the criteria rules.

Check lengths, spaces and formats with LEN#

LEN counts characters, which makes it a quick test for fixed-length codes and hidden spaces:

CheckFormulaRow that fails
ID must be 6 characters=LEN(A7)=6Row 7: C-105 has 5
No extra spaces in the name=LEN(B7)=LEN(TRIM(B7))Row 7: leading space
Email has @ and a dot after it=ISNUMBER(SEARCH("@*.*",C4))Row 4: no dot after @
Amount can't be negative=D7>=0Row 7: −20

TRIM removes extra spaces, so if the length changes, the cell had some. The email test uses SEARCH with wildcards: * stands for any characters, so "@*.*" means "an @, then later a dot". SEARCH returns a position or an error, and ISNUMBER turns that into TRUE or FALSE; see how ISNUMBER and SEARCH check for text. The LEN function guide has more length tests.

This email check is a rough filter, not full validation. It catches obvious typos, which is usually enough.

Combine the checks into one status column#

Once each rule works, combine them with AND inside IF. AND is TRUE only when every test passes. In E2:

Excel formula
=IF(AND(B2<>"",ISNUMBER(D2),COUNTIF($A$2:$A$7,A2)=1,LEN(A2)=6),"OK","Check")

Fill it down. Rows 2 and 5 show OK; rows 3, 4, 6 and 7 show Check. Add or remove tests inside AND to match your own rules.

A status of "Check" doesn't say why. In Microsoft 365 or Excel 2019 and later, TEXTJOIN can list the reasons:

Excel formula
=TEXTJOIN(", ",TRUE,IF(B2="","No name",""),IF(ISNUMBER(D2),"","Amount is text"),IF(COUNTIF($A$2:$A$7,A2)>1,"Duplicate ID",""))

Row 3 shows Amount is text, Duplicate ID. TRUE as the second argument skips the empty results, so clean rows stay blank.

Finally, put a summary at the top of the sheet: =COUNTIF(E2:E7,"Check") returns 4. Pair it with a conditional formatting rule that fills Check rows in light red, and problems are hard to miss.

Prevent bad data at the source#

Checks find problems after the fact. Where people type data in by hand, stop the problems first with Data > Data Validation: allow only whole numbers in Amount, set a text length of 6 for IDs, or offer a drop-down list. The guide to data validation rules shows each setting. Keep the checks column anyway, because pasted data skips validation.

The same approach works for any list you receive, from a CRM export to survey results you need to summarise.

Practise it#

Each check here uses a skill you can practise on its own. Practise IS functions in a live spreadsheet to test values with ISNUMBER and ISBLANK, use the COUNTIF lesson to find duplicates, and fix what you find in the cleaning messy text lesson. Every lesson checks your formula as soon as you press Enter.

Try it yourself

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

In E3, check row 3 with IF and AND: it is OK only if the amount (D3) is a real number, the ID (A3) appears once in $A$2:$A$7, and the ID is 6 characters long. Otherwise show Check.

fx
ABCDEF
1
ID
Customer
Email
Amount
Status
2
C-1001
Ana Ruiz
ana@example.com
250
3
C-1002
Ben Cole
ben@example.com
180
4
C-1003
chloe@example
95
5
C-1004
Dev Shah
dev@example.com
410
6
C-1002
Ben Cole
ben@example.com
180
7
C-105
Ema Lund
ema@example.com
-20
8
9
10

Tip: AND takes the three tests separated by commas: ISNUMBER(D3), COUNTIF(...)=1 and LEN(A3)=6.

Practise this in a lesson

LessonIS functions and SWITCHCheck what's really in a cell with ISBLANK, ISNUMBER and ISTEXT, and turn short codes into labels with SWITCH.LessonCOUNTIFCount the cells that match a condition, from exact words to number checks like ">=8".LessonCleaning messy textFix stray spaces, random capitals and inconsistent separators in imported data with TRIM, PROPER, UPPER, LOWER and SUBSTITUTE.Function guideISNUMBERUse ISNUMBER to catch numbers stored as text and, with SEARCH, to test whether a cell contains a word. Examples, pitfalls and live practice.Function guideCOUNTIFCount cells that match one condition with COUNTIF: text, numbers, wildcards and cell references. Real examples and a live exercise.Function guideLENCount characters with Excel's LEN: check length limits, find stray spaces and count commas with SUBSTITUTE. Examples and a live exercise.

Frequently asked questions

How do I check data quality in Excel?

+

Add a helper column with formulas that test each rule: blanks, numbers stored as text, duplicates, wrong lengths and values out of range. Combine the tests with AND inside IF so each row shows OK or Check, then count the Check rows.

How do I find numbers stored as text in Excel?

+

Use =ISNUMBER(D2), which returns FALSE for a number stored as text. To count them in a column, use =COUNTA(D2:D7)-COUNT(D2:D7), which counts filled cells that are not real numbers.

How do I flag duplicate IDs with a formula?

+

Use =COUNTIF($A$2:$A$7,A2)>1 and fill it down. It returns TRUE on every row whose ID appears more than once. Lock the range with $ so it doesn't move as you fill.

What is the difference between data validation and data quality checks?

+

Data validation stops bad values from being typed in the first place. Data quality checks are formulas that find problems in data that is already there, such as an import or a pasted export.

Sources

  • IS functions - Microsoft Support
  • COUNTIF function - Microsoft Support
  • LEN, LENB functions - Microsoft Support

Written and checked by the ExcelReady Team. First published November 3, 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. Why run data quality checks before you analyse?
  2. Check for blanks and missing values
  3. Check for numbers stored as text with ISNUMBER
  4. Find duplicate IDs with COUNTIF
  5. Check lengths, spaces and formats with LEN
  6. Combine the checks into one status column
  7. Prevent bad data at the source
  8. Practise it

Keep reading

Data tools· 6 min read

Data Validation Rules in Excel: Limit What Users Can Enter

Select the cells, go to Data > Data Validation, and choose what to allow: a whole number, decimal, list, date, time, text length or a custom formula. Set the limits, add an input message and an error alert, and click OK. Excel then rejects typed entries that break the rule. Custom rules use any formula that returns TRUE for valid entries.

Logic· 7 min read

ISNUMBER and SEARCH: Check if a Cell Contains Text

Use =ISNUMBER(SEARCH("refund",B2)). SEARCH looks for the text inside B2 and returns its position as a number, or a #VALUE! error if it isn't there. ISNUMBER turns that into TRUE or FALSE. Wrap it in IF to show your own labels, and swap SEARCH for FIND when capitals must match exactly.

Text· 7 min read

Clean Messy Data in Excel With TRIM, CLEAN and PROPER

Use TRIM to remove extra spaces, CLEAN to remove hidden non-printing characters, and PROPER to put a capital at the start of each word. Nest them to fix several problems at once: =PROPER(TRIM(A2)) turns " maria gonzalez" into "Maria Gonzalez". Build the clean version in a new column, check it, then paste it as values.

More on logic

  • What the Double Negative (--) Does in Excel Formulas
  • Letter Grade Formula in Excel: IFS or a Lookup Table
  • IF with AND in Excel: Check Two Conditions at Once
  • Use AND and OR Together in One IF Formula
  • IF Between Two Numbers in Excel
  • IF Cell Is Blank in Excel: Formulas That Work
All logic articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free