Example 1
Count one status
B13 =COUNTIF(C2:C11,"Open")
Result: 4
T-201, T-203, T-204 and T-208 are open.
B13 =COUNTIF(C2:C11,"Open") returns 4
Counts the cells in a range that meet one condition, such as every ticket with the status Open.
Syntax
=COUNTIF(, )
All versions of Excel, including Excel for Microsoft 365 and Excel for the web.
Try it
Edit the formula in B13 or change the inputs. The sheet recalculates as you type.
B13 =COUNTIF(C2:C11,"Open") returns 4
COUNTIF counts how many cells in a range pass a test. It answers "how many open tickets?", "how many orders over 50?" and "how many names start with N?" without any filtering.
The criteria can take several forms:
"Open" or 3 counts cells equal to it. Text matching ignores case, so "open" also matches Open.">=3", "<100" or "<>Closed". The operator and the value sit together inside one pair of quotes."Net*" matches anything starting with Net, "*air*" anything containing air, and "?ccess" any single character followed by ccess. To search for a real * or ?, put a ~ before it.E2 uses whatever is in E2, so one formula can be reused for different values.">"&E2 counts cells greater than the value in E2.Two special criteria are worth knowing: "<>" counts cells that are not empty, and "" counts cells that are empty.
Dates are numbers, so compare them like numbers. To count dates after a cut-off held in E1, use ">"&E1. Typing a date straight into the criteria, such as ">1/31/2025", depends on the regional settings, so a cell reference or ">"&DATE(2025,1,31) is safer.
#VALUE!.COUNT, COUNTA and COUNTBLANK count by cell type, with no condition. To add up the matching numbers rather than count them, use SUMIF. To average them, use AVERAGEIF.
COUNTIF also finds duplicates: =COUNTIF($A$2:$A$11,A2)>1 flags every value that appears more than once.
C2:C11. It can be a column, a row or a block.">=3", "<>Closed" or "Net*". Text and operators go in quotes. * matches any run of characters and ? matches one character.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
B13 =COUNTIF(C2:C11,"Open")
Result: 4
T-201, T-203, T-204 and T-208 are open.
B13 =COUNTIF(C2:C11,"Open") returns 4
Example 2
B13 =COUNTIF(C2:C11,"<>Closed")
Result: 6
Ten tickets, four of them closed. The "<>" operator counts the other six.
B13 =COUNTIF(C2:C11,"<>Closed") returns 6
Example 3
B13 =COUNTIF(B2:B11,"Net*")
Result: 3
"Net*" matches Network. T-204, T-207 and T-210 belong to it.
B13 =COUNTIF(B2:B11,"Net*") returns 3
Example 4
B14 =COUNTIF(D2:D11,"<="&B13)
Result: 7
The operator is joined to B13 with &. Seven tickets have priority 2 or lower. Change B13 and the count follows.
B14 =COUNTIF(D2:D11,"<="&B13) returns 7
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In F2, count the orders for the region named in E2.
Answer in F2.
"E2", counts cells equal to the text E2. Write E2 without quotes, or ">"&E2 to combine it with an operator.COUNTIF(C2:C9,50) counts cells equal to 50. Use ">=50" for 50 or more."Open " is not "Open". Clean the data with TRIM, or use wildcards such as "Open*".Ab from AB. Use SUMPRODUCT with EXACT for a case-sensitive count.#VALUE!, and COUNTIF treats long numeric-looking text, such as 16-digit codes, as numbers, so it can match more than you expect.Use an operator inside quotes: `=COUNTIF(B2:B9,">100")`. To read the number from a cell, join them: `=COUNTIF(B2:B9,">"&E2)`.
Not on its own. Use COUNTIFS: `=COUNTIFS(A2:A9,"East",B2:B9,">100")`. For OR logic, add two COUNTIF results together.
Wrap the text in asterisks: `=COUNTIF(A2:A9,"*air*")` counts cells that contain air anywhere.
Anchor the range and point at the first cell: `=COUNTIF($A$2:$A$11,A2)` and fill down. Any result above 1 is a duplicate.
No. `"open"` matches `Open` and `OPEN`.
COUNTIF is taught in Data analysis with formulas, lesson 3: Criteria with operators. Each lesson is a short, graded exercise like the one above.