Perform logical operations by using the COUNTIF() function
=COUNTIF($B$2:$B$7, E2)Count the cells in B2:B7 that match E2. COUNTIF has no range to total: it counts the cells it tests.
What the MO-211 task asks
A COUNTIF task asks how many: “count how many of the SoldOut flags read Yes”, or “count how many of the six Net totals in N13:N18 are above 1,000”. One condition and a count is COUNTIF; two or more is COUNTIFS.
The condition is either a value (Yes, a cell such as E2) or a comparison in quotes (">1000"). Take the comparison from the task's own words: “above” is >, “at least” is >=.
Our grader checks the value in every cell of the target range. It reads the values, not the function, so any formula that produces them earns the points — but one wrong cell fails the whole range.
Worked examples
Type these into a blank sheet to follow along. Every result below is what Excel showed.
| A | B | C | |
|---|---|---|---|
| 1 | Item | Status | Stock |
| 2 | Bolts | In stock | 120 |
| 3 | Nuts | Low | 8 |
| 4 | Washers | In stock | 300 |
| 5 | Screws | Out | 0 |
| 6 | Rivets | Low | 5 |
| 7 | Pins | In stock | 45 |
| E | F | |
|---|---|---|
| 1 | Status | Items |
| 2 | Low | 2 |
| 3 | In stock | 3 |
| 4 | Out | 1 |
=COUNTIF(B2:B7, "Low")Nuts and Rivets are Low.
=COUNTIF(C2:C7, "<10")8, 0 and 5 are under 10. The operator goes inside the quotes.
=COUNTIF(B2:B7, "<>In stock")The items that are Low or Out.
=COUNTIF($B$2:$B$7, E2)Each row counts its own status from column E across the same locked range. This is what the video below builds.
Watch it done in Excel
The last example above, recorded in real Excel on the same grid.
Exam traps
Unlocked, =COUNTIF(B2:B7, E2) filled to F3 becomes =COUNTIF(B3:B8, E3) and counts 2 In stock items, not 3: Bolts has slid out of the range.
=COUNTIF(C2:C7, <10) is not a formula Excel will accept. Write "<10", or "<"&E5 to compare with a cell.
=COUNTIF(C2:C7, ">45") returns 2 and =COUNTIF(C2:C7, ">=45") returns 3: Pins has exactly 45. Take the operator from the task's word.
COUNTIF returns how many cells match, never their sum. =COUNTIF(B2:B7, "In stock") is 3 items, not the 465 units they hold; a total is SUMIF.
FAQ
Is COUNTIF case-sensitive?
No. =COUNTIF(B2:B7, "low") returns 2.
Can COUNTIF count blank cells?
Yes: the condition is empty quotes. =COUNTIF(D2:D7, "") returns 6 here, because column D is empty.
Can I use wildcards?
Yes. =COUNTIF(A2:A7, "*s") counts the items ending in s and returns 6.
New to this function?
This page covers what the exam asks. For the full how-to — every argument, more examples and a practice workbook — read our guide on dfwexcel.com.
The COUNTIF function, explained — dfwexcel.comTry it under exam conditions
Take a full, timed MO-211 practice exam, upload the workbook you built, and get a score out of 1000 with a per-task breakdown of where the points went. Your first one is free.
No credit card needed.
