FormulaCraft

Fix the Wrong count error

Excel & Google Sheets
Topic:COUNTIF & COUNTIFS

What Wrong count means

When COUNTIF returns a count but the number is higher or lower than expected, the formula found matches — just the wrong ones. Over-counting is usually caused by wildcard patterns matching too broadly or duplicates in the range. Under-counting is usually caused by data-type mismatches or hidden characters preventing recognition of a cell.

Common causes

Example fix

Broken
=COUNTIF(A1:A100,"Jan*")
Fixed
=COUNTIF(A2:A100,"January")

The broken formula started at A1 (including the header 'Jan Sales') and used a wildcard that matched January, Janitor, etc. The fixed version excludes the header and uses an exact criteria.

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How to fix it

  1. 1Be more specific with wildcards: instead of "Jan*" use the full word "January" if you only want January, or verify exactly what the wildcard matches in a helper column.
  2. 2To count only visible rows after filtering, use SUBTOTAL: =SUBTOTAL(102,A2:A100). SUBTOTAL(102,...) counts non-blank visible cells only.
  3. 3Exclude the header row by starting the range at row 2: =COUNTIF(A2:A100,"criteria") instead of =COUNTIF(A:A,"criteria").
  4. 4Standardise dates: ensure the criteria_range column is formatted as Date (not Text) and use a DATE() formula or a cell reference containing a real date as criteria.
  5. 5Remove duplicates from source data if they are unintentional (Data > Remove Duplicates in Excel; Data > Remove Duplicates in Sheets), then re-run the count.

Stop hunting errors by hand.

Upload your spreadsheet and the Auditor flags every Wrong count and broken formula at once — or paste this one formula and get the fix explained.

Frequently asked

How do I count unique values with COUNTIF?

Use SUMPRODUCT with 1/COUNTIF: =SUMPRODUCT(1/COUNTIF(A2:A100,A2:A100)) counts unique values in a range. Add an IF to handle blanks: =SUMPRODUCT((A2:A100<>"")/COUNTIF(A2:A100,A2:A100&"")).

Why does COUNTIF count hidden rows?

COUNTIF is a range function, not a filtered-view function. To respect filters, use SUBTOTAL(102, range) for a count of visible non-blank cells, or AGGREGATE in Excel.

My COUNTIF count is 1 higher than expected — what is the most likely cause?

The header row is almost certainly included in the range and the header text matches the criteria. Start your range from row 2 instead of row 1.

More on COUNTIF & COUNTIFS

See all →

Related formulas

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: