Maintenance Notification: We are upgrading our servers today so you may experience intermediate outages. Thank you for your patience.
Perform logical operations in formulas
MO-211

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.

Inventory
ABC
1ItemStatusStock
2BoltsIn stock120
3NutsLow8
4WashersIn stock300
5ScrewsOut0
6RivetsLow5
7PinsIn stock45
Counts (the video fills F2:F4)
EF
1StatusItems
2Low2
3In stock3
4Out1
Counting a text value
=COUNTIF(B2:B7, "Low")
Returns 2

Nuts and Rivets are Low.

Counting with a comparison
=COUNTIF(C2:C7, "<10")
Returns 3

8, 0 and 5 are under 10. The operator goes inside the quotes.

Everything except one value
=COUNTIF(B2:B7, "<>In stock")
Returns 3

The items that are Low or Out.

Filled down a column
=COUNTIF($B$2:$B$7, E2)
Returns 2, 3, 1 in F2:F4

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

Filling down without locking

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.

A comparison without quotes

=COUNTIF(C2:C7, <10) is not a formula Excel will accept. Write "<10", or "<"&E5 to compare with a cell.

“Above” is not “at least”

=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.

Counting, when the task wants a total

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.com

Try 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.