Excel Practice Test

โ–ถ

The COUNTIF function in Excel counts cells that match a single condition you give it. Type a range, type a rule, hit enter, and you get a number. That is it. No setup, no macros, no add-ins. It is one of the first functions most analysts learn, and it stays useful for years because every spreadsheet has data you need to filter and count quickly.

Here is the basic shape: =COUNTIF(range, criteria). The range is the cells you want to look at. The criteria is the rule those cells need to match. For example, =COUNTIF(A2:A100, "Active") counts how many cells in that column contain the text "Active". Swap the word for any value, number, or comparison and Excel handles it.

People often confuse COUNTIF with COUNT or COUNTA. COUNT only handles numbers. COUNTA counts any non-empty cell. COUNTIF lets you filter, which is the part that matters for most reports. Need a count tied to multiple rules? That is where COUNTIFS (with the S) takes over, and we will cover that distinction later.

This guide walks through real examples, common errors, and the workflow questions that come up on the job and on certification exams. Each section is short, hands-on, and tied to the kind of practice you would expect on a Microsoft Excel test. You will see how to count text, numbers, dates, partial matches, blanks, and values from another sheet.

Excel COUNTIF at a Glance

๐Ÿ“Š
2
Arguments only โ€” range and criteria are the entire signature you need to learn
๐Ÿ”
*?
Wildcards supported for partial text matches across any string of characters or a single character
โšก
1M+
Rows handled per call without measurable slowdown on a modern machine running Excel 365
๐Ÿ”ค
No
Case sensitivity by default โ€” Open, OPEN and open all match the same criteria string

How COUNTIF actually works

COUNTIF scans a range one cell at a time. For each cell, it checks whether the value satisfies your criteria. If it does, the counter goes up by one. When the scan ends, Excel returns the total. The function does not modify your data, sort anything, or move cells. It is purely a read operation, which is why it is safe to drop into any worksheet.

The criteria can be a literal value, a cell reference, or a comparison expression wrapped in quotes. Numbers do not need quotes when used alone, but anything with an operator does. So =COUNTIF(B2:B50, 100) works, and so does =COUNTIF(B2:B50, ">100"). Mix them up and Excel returns a #VALUE error or, worse, a silent zero.

Wildcards open up partial-match counting. The asterisk (*) stands in for any string of characters. The question mark (?) stands in for any single character. So =COUNTIF(C2:C200, "*report*") counts every cell containing the word "report" anywhere in the text. That trick alone saves hours on messy data.

Real-world example: counting status entries

Picture a help-desk log with 500 rows. Column D holds ticket status: Open, In Progress, Resolved, Closed. Your manager wants a quick tally. You write =COUNTIF(D2:D501, "Open") in one cell, repeat for each status with the label changed, and you have a four-line summary in under a minute. No filters, no PivotTable setup, no sort step.

=COUNTIF(range, criteria) โ€” the range is the cells to scan, the criteria is the rule each cell must match. Quotes go around text values, any comparison expression, and dates. Numbers used alone do not need quotes. Cell references work in place of literal values, which lets you change the criteria from a dropdown without rewriting the formula.

Counting numbers and date ranges

COUNTIF reads numbers and dates the same way it reads text, but operators unlock the real power. Suppose column E has sales totals. You want to know how many sales exceeded 1,000 dollars. Type =COUNTIF(E2:E1000, ">1000") and Excel returns the count. Drop the quotes around the operator and the formula breaks, so keep them.

Dates work the same way once you wrap them in quotes. =COUNTIF(F2:F1000, ">=1/1/2026") counts entries from the start of 2026 onward. To pull dates from a cell, use the ampersand: =COUNTIF(F2:F1000, ">="&G1) where G1 holds your reference date. Excel reads the cell value, glues it to the operator, and counts the result.

If you need a window between two dates, COUNTIF alone will not do it because the function only takes one criteria. You can subtract two COUNTIF calls (one for the upper bound, one for the lower) or move to COUNTIFS. Most analysts switch to COUNTIFS at this point because the syntax is cleaner.

Counting blanks and non-blanks

Blanks trip up everyone. To count truly empty cells, use =COUNTIF(A2:A100, ""). To count cells with any value, use =COUNTIF(A2:A100, "<>") or COUNTA, which is shorter. There is a gotcha: a cell holding an empty string from a formula counts as non-blank to COUNTIF but blank to ISBLANK. If your data comes from a query or import, test both and pick the one that matches what you see.

Four COUNTIF Patterns You Will Reuse

๐Ÿ”ด Exact match

=COUNTIF(A2:A100, "Active") counts every cell whose value equals the word Active. Case is ignored, so Active and ACTIVE both count. This is the most common pattern in status reports and category tallies.

๐ŸŸ  Comparison

=COUNTIF(B2:B100, ">500") counts numbers above 500. The operator and the value stay inside the quotes together as a single string. Forget the quotes and Excel throws a #NAME or #VALUE error before it even tries to count.

๐ŸŸก Wildcard

=COUNTIF(C2:C100, "*report*") counts cells containing the word report anywhere in the text. Useful when a column has descriptive strings rather than tidy category labels. Works on text-formatted cells only.

๐ŸŸข Cell reference

=COUNTIF(D2:D100, E1) reads the criteria from E1. Change the value in E1 and the count refreshes instantly. This pattern powers dropdowns, slicers, and small KPI dashboards.

Wildcards and partial matches

Wildcards turn COUNTIF into a quick text search. The asterisk wildcard matches zero or more characters. The question mark matches exactly one. Combine them and you can count anything that fits a pattern, not just an exact string.

Say you have a column of product codes like ABC-123, ABC-124, XYZ-001. To count every code starting with ABC, write =COUNTIF(A2:A500, "ABC*"). To count three-letter codes ending in 7, use =COUNTIF(A2:A500, "??7"). For codes containing exactly five characters, you would write five question marks in a row. It looks odd, but it works.

Wildcards do not work on numeric data unless the numbers are stored as text. If your column is formatted as Number, COUNTIF treats them as values and the wildcards are ignored. To force a text comparison, either format the column as Text or wrap your data in a TEXT function inside an array formula. Most people just convert the column.

Case sensitivity (or lack thereof)

COUNTIF is not case sensitive. "Open", "OPEN", and "open" all match the same criteria. If you need a case-sensitive count, you have to combine SUMPRODUCT with EXACT, like =SUMPRODUCT(--EXACT(A2:A100, "Open")). That formula respects letter case. For most reporting tasks the default behavior is fine, but exam questions sometimes test whether you know the limitation.

COUNTIF Criteria Types

๐Ÿ“‹ Text

Wrap text in quotes like "Open" or "Resolved". The match ignores case so Open, OPEN, and open all return the same total. Wildcards (asterisk for any string, question mark for a single character) work inside text criteria and dramatically widen what you can match. Watch for trailing spaces โ€” they break exact-match counts every time.

๐Ÿ“‹ Numbers

Use the value alone for an equality check or wrap an operator with the value in quotes when you need a comparison: 100 matches exactly one hundred, while ">100" counts everything above one hundred. The same trick works for less-than, greater-than-or-equal, and not-equal-to comparisons, which makes COUNTIF a quick replacement for a filter on a numeric column.

๐Ÿ“‹ Dates

Quote the date and operator together as one string: "<=12/31/2026" counts rows on or before that date. For dynamic references, concatenate the operator with a cell using the ampersand: ">="&G1. The ampersand glues Excel's serial date number to the operator and the comparison resolves correctly.

๐Ÿ“‹ Blanks

Use "" for cells that are truly empty and "<>" for cells holding any value. Be careful: cells that look blank but actually contain an empty string from a formula are counted as non-blank by COUNTIF even though ISBLANK reports them as empty. Test both functions on the same range when the numbers feel off and pick the one that matches reality.

COUNTIF vs COUNTIFS

Excel ships with both COUNTIF and the multi-criteria COUNTIFS sibling. COUNTIF handles a single rule. COUNTIFS handles two or more rules joined by AND logic. The syntax for COUNTIFS pairs each range with its own criteria, like =COUNTIFS(A2:A100, "Open", B2:B100, ">100"). Each range must be the same size, or Excel throws a #VALUE error.

Use COUNTIF when you only need one condition. Switch to COUNTIFS the moment you need to filter by two columns at once. Some teams default to COUNTIFS for everything because it future-proofs the formula, since you can add criteria later without rewriting the whole thing. The performance cost is negligible on normal-sized data.

Counting from another sheet or workbook

COUNTIF works across sheets. Reference the source sheet name, an exclamation mark, then the range: =COUNTIF(Sales!B2:B500, ">1000"). If the sheet name has spaces, wrap it in single quotes: =COUNTIF('Q4 Sales'!B2:B500, ">1000"). The function does not need the source sheet to be active.

Cross-workbook references work too, but they break the moment the other file is closed. For shared reporting, copy the data into the same workbook or use Power Query to import it. Linked workbooks cause more pain than they solve, especially when files move or get renamed.

Common COUNTIF errors and fixes

Three errors come up over and over. The first is #VALUE, which usually means your range and criteria do not match in type. Maybe the column is formatted as Date but the criteria is a string. Convert one or the other and the formula clears.

The second is a result of zero when you expected something. Check for stray spaces in your data. A cell that looks like "Open" but actually contains "Open " (with a trailing space) will not match the criteria "Open". Use the TRIM function in a helper column or run Find and Replace to clean it.

The third is an inflated count from wildcards you did not intend. If your criteria contains a literal asterisk or question mark, escape it with a tilde: =COUNTIF(A2:A100, "~*"). Without the tilde, Excel treats the asterisk as "match anything" and returns the count of every cell.

A fourth gotcha worth mentioning is mixed data types in the same column. If a few cells in a number column were entered as text (a green triangle in the corner usually signals this), COUNTIF on a numeric comparison will skip them. Convert the column to numbers via Paste Special or the VALUE function and the count corrects itself.

Performance on large datasets

COUNTIF is fast on tens of thousands of rows but slows down on hundreds of thousands when stacked dozens of times in a workbook. If your file feels sluggish, switch repeated COUNTIF calls to a PivotTable or use Power Query for the heavy lifting. A single COUNTIF on 100,000 rows recalculates in milliseconds. Two hundred of them on the same range will lag noticeably.

For very large workbooks, consider switching calculation to manual mode while you edit, then hit F9 to recalculate when you are ready. This stops every keystroke from triggering a full recalculation cycle, which is the actual reason big COUNTIF-heavy files feel slow rather than the function itself being inefficient.

COUNTIF Troubleshooting Checklist

Check for trailing or leading spaces in your data and run TRIM in a helper column when results look low
Confirm the cell format matches the criteria type โ€” text against text, number against number, date against date
Lock your range with dollar signs ($A$2:$A$1000) before copying the formula down so the source window never shrinks
Escape literal asterisk and question mark characters with a tilde (~) in the criteria string when you mean them literally
Verify the range and criteria are inside quotes whenever the criteria includes an operator like greater-than or not-equal
Test for empty strings from formulas separately from true blanks by comparing COUNTIF to COUNTBLANK on the same range
Swap to COUNTIFS the moment you need a second condition rather than stacking multiple COUNTIF results together
Use a named range when the source data lives far away โ€” it makes the formula readable and survives column shuffles

Practice scenarios you should know

Certification exams and job interviews lean on a handful of COUNTIF patterns. Counting orders above a threshold. Counting names matching a department. Counting dates inside a quarter. Counting blanks in a survey column. Counting unique values (technically with a helper formula since COUNTIF alone does not handle uniqueness directly). Working through each one in a real workbook beats memorizing syntax.

Try this drill: open a blank worksheet, paste a list of fifty random names with a status column, and write five COUNTIF formulas in five different cells. Count the active ones. Count the names starting with M. Count the blanks. Count the names with exactly four letters. Count the rows where the status is anything other than Closed. If all five return what you expect, you understand the function well enough for most jobs.

A second drill that helps is the dashboard build. Create a small KPI grid where each cell uses a different COUNTIF to summarise a column. Add a dropdown that swaps the criteria via a cell reference. When you change the dropdown, every count refreshes instantly. This is exactly how production dashboards behave, and exam scenarios often test whether you can wire one up without help.

When COUNTIF is not the right tool

Two situations call for a different function. If you need to sum values that match a rule, not count them, use SUMIF or its multi-criteria cousin. If you need to look up a value tied to a match, use VLOOKUP or its modern replacement. COUNTIF answers "how many," not "how much" or "which one."

For complex conditions involving OR logic, COUNTIF needs to be repeated and summed: =COUNTIF(A2:A100, "Open") + COUNTIF(A2:A100, "Pending"). Some analysts wrap multiple criteria in an array constant: =SUM(COUNTIF(A2:A100, {"Open","Pending"})). Both work. Pick the style your team reads more easily.

If you need a count that responds to a slicer or a filter on a Table, the SUBTOTAL function is the better choice. SUBTOTAL respects hidden rows from filters, while COUNTIF ignores filter state entirely. Mixing them in the same sheet without realising the difference is a classic source of mismatched numbers in reports.

Try the Excel Formulas Practice Test

Tips that save time

Lock your ranges with dollar signs the moment you plan to copy a COUNTIF formula across cells. =COUNTIF($A$2:$A$100, B2) stays anchored to the source range while the criteria shifts down with each new row. Skip the dollar signs and you end up counting smaller and smaller windows.

Name your ranges when a workbook gets complex. Instead of =COUNTIF(A2:A500, "Open"), define a name like "TicketStatus" and write =COUNTIF(TicketStatus, "Open"). The formula reads almost like English and survives column rearrangements.

Use COUNTIF inside conditional formatting to flag duplicates. The rule =COUNTIF($A$2:$A$1000, A2)>1 highlights every cell whose value appears more than once. It is the cleanest way to spot duplicates without sorting the column first. Drop the rule in, watch the highlights appear, and decide what to do from there.

Combining COUNTIF with other functions

COUNTIF gets even more powerful when you nest it inside other formulas. Want a percentage of cells matching a rule? Wrap a COUNTIF in a division: =COUNTIF(A2:A100, "Open") / COUNTA(A2:A100). Format the result as a percentage and you have a ratio that updates the moment data changes.

You can also chain COUNTIF with IF to control branching logic. For example, =IF(COUNTIF(A2:A100, "Open")>5, "Alert", "OK") returns a status label based on the count. This pattern shows up constantly in dashboards where a manager wants a quick green or red indicator.

Even array formulas use COUNTIF as a building block. The classic unique-value count formula, =SUMPRODUCT(1/COUNTIF(A2:A100, A2:A100)), leans on COUNTIF to figure out how many times each value appears and then sums the reciprocals. The math is clever, and it works once you stop fighting the syntax. In modern Excel, the UNIQUE function does the same job in one step, but the older formula still ships in countless legacy workbooks.

Where COUNTIF fits in your Excel toolkit

Most analysts use a small handful of functions every day. SUM, AVERAGE, IF, VLOOKUP or XLOOKUP, COUNTIF, and a PivotTable cover at least eighty percent of real workbooks. COUNTIF sits in the middle because counting is the foundation of every report. Before you can chart anything, you usually need to know how many of something exist. Before you can write a summary, you need the totals. COUNTIF is the function that gets you there fastest.

If you are studying for a Microsoft Office Specialist exam or a job interview, drill COUNTIF until the syntax feels automatic. Practice writing it with text, with numbers, with comparisons, with wildcards, and with cell references. Practice fixing the common errors. Practice spotting when COUNTIFS is the better choice. The function is small, but the situations where it shows up are everywhere, and a confident hand with it signals that you actually use Excel and not just that you have read a tutorial about it.

COUNTIF Strengths and Limits

Pros

  • Simple two-argument syntax anyone can read
  • Fast on large ranges, no setup needed
  • Works with text, numbers, dates, and wildcards
  • Plays well with conditional formatting for duplicate detection

Cons

  • Only handles one criteria โ€” needs COUNTIFS for multiple rules
  • Not case sensitive without a SUMPRODUCT workaround
  • Wildcards do not work on numeric-typed cells
  • Cross-workbook references break when the source file is closed
Take the Excel Functions Quiz

Excel Questions and Answers

What does the COUNTIF function do in Excel?

COUNTIF counts how many cells in a range match a single condition you specify. The condition can be a value, a comparison, or a text pattern with wildcards.

What is the syntax of COUNTIF?

=COUNTIF(range, criteria). The range is the cells to scan and the criteria is the rule each cell must meet. Quotes wrap text and any operator-based comparison.

How do I count cells greater than a number with COUNTIF?

Use the operator inside quotes: =COUNTIF(B2:B100, ">100"). The whole comparison stays as one string. Drop the quotes and the formula breaks.

Is COUNTIF case sensitive?

No. COUNTIF treats Open, OPEN, and open as the same value. For case-sensitive counting, use SUMPRODUCT combined with EXACT instead.

Can COUNTIF use wildcards?

Yes. The asterisk matches any string of characters and the question mark matches one character. Wildcards work on text but not on numeric-typed cells.

What is the difference between COUNTIF and COUNTIFS?

COUNTIF handles a single criteria. COUNTIFS handles multiple criteria joined by AND logic. Switch to COUNTIFS the moment you need to filter by two or more columns at once.

How do I count blanks with COUNTIF?

Use =COUNTIF(range, "") for truly empty cells. Note that cells containing an empty string from a formula will be treated as non-blank by some functions but blank by ISBLANK.

Can COUNTIF reference another sheet?

Yes. Reference the sheet name followed by an exclamation mark: =COUNTIF(Sales!B2:B500, "Active"). Wrap sheet names with spaces in single quotes.
โ–ถ Start Quiz