Counting function
Excel COUNTIF function
COUNTIF counts the cells in a range that meet one condition. Use it to count orders from one region, scores above a pass mark, or tasks marked "Done". For more than one condition, use COUNTIFS.
=COUNTIF(range, criteria)Arguments
range- The cells to check.
criteria- The condition, like "Done", 50, ">=70" or "A*". Text and operators go in quotes.
COUNTIF examples
Every result below was calculated from this sample sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Task | Owner | Status | Hours |
| 2 | Write brief | Kim | Done | 3 |
| 3 | Design logo | Raj | In progress | 8 |
| 4 | Draft copy | Kim | Done | 5 |
| 5 | Build page | Alex | Not started | 12 |
| 6 | QA review | Raj | Done | 2 |
| 7 | Launch email | Kim | In progress | 4 |
Result: 3
How many tasks are finished. The match is not case-sensitive.
Result: 3
Put the operator and number in quotes to count tasks of 5 hours or more.
Result: 3
"<>" means not equal to, so this counts everything still open.
Result: 2
The * wildcard matches any characters, so this counts tasks starting with D.
How to use COUNTIF
- Click an empty cell.
- Type =COUNTIF( and select the range to check.
- Type a comma and the condition in quotes, like "Done".
- Close the bracket and press Enter.
Common COUNTIF mistakes
Operator outside the quotes
Write ">=5", not >="5" or >=5. The whole condition is one text string.
Comparing to a cell value
Join the operator to the cell with &: COUNTIF(D2:D7,">"&F1). Writing ">F1" looks for the text F1.
Extra spaces in the data
"Done " with a trailing space does not match "Done". Clean the data with TRIM or use "Done*".
COUNTIF FAQ
How do I count cells with specific text in Excel?
Use =COUNTIF(range,"text"). To count cells that contain the text anywhere, use wildcards: =COUNTIF(range,"*text*").
How do I use COUNTIF with multiple criteria?
Use COUNTIFS, which takes pairs of ranges and conditions. For an OR condition, add two COUNTIFs together.
Is COUNTIF case-sensitive?
No. "done", "Done" and "DONE" all match. Use SUMPRODUCT with EXACT if you need a case-sensitive count.
Why is my COUNTIF returning 0?
Common causes are extra spaces, numbers stored as text, or the operator placed outside the quotes. Test one cell with = to see if it really matches.
Practice COUNTIF in these lessons
- Conditional math: COUNTIF
- Data cleanup: Duplicates and uniques
- Project: Monthly budget
- Project: Sales commission report
- Project: Clean a CRM export
- Project: Inventory reorder alerts
Guides that use COUNTIF
- How to count unique values in Excel
- How to find duplicates in Excel
- How to compare two columns in Excel
- How to use COUNTIF greater than in Excel
- How to count cells with text in Excel
- How to make a running total in Excel
- If a cell contains text, return a value in Excel
- Excel formula for letter grades
Related functions
COUNTIFSCounts with several conditionsSUMIFAdds cells that matchCOUNTACounts non-empty cellsAVERAGEIFAverages cells that match
Updated