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 COUNTIFS() function

=COUNTIFS($A$2:$A$7, E2, $B$2:$B$7, F2)

Count the rows where the clinic matches E2 and the injury matches F2. Pairs of range and condition, and no range to total.

What the MO-211 task asks

COUNTIFS is the count with “both conditions must hold”: “count the Bayside patients still reporting a Pain Score of 6 or worse … Both conditions must hold”, or “count the weeks that took more than 6000 Admissions AND held an Avg Ticket of at least 8.8”.

Each condition is a range and a test. “6 or worse” on a pain score is >=6; “more than 6000” is >6000. The same column can appear twice, which is how you count values between two limits.

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.

Patients
ABC
1ClinicInjuryPain
2CentralKnee7
3BaysideBack6
4CentralBack3
5BaysideKnee8
6CentralKnee2
7BaysideKnee5
Counts (the video fills G2:G4)
EFG
1ClinicInjuryPatients
2BaysideBack1
3CentralKnee2
4CentralHip0
Two conditions
=COUNTIFS(A2:A7, "Bayside", B2:B7, "Knee")
Returns 2

Rows 5 and 7 are both Bayside and Knee.

A text and a number condition
=COUNTIFS(A2:A7, "Bayside", C2:C7, ">=6")
Returns 2

Bayside patients with a pain score of 6 or worse: 6 and 8.

Between two limits
=COUNTIFS(C2:C7, ">=3", C2:C7, "<=6")
Returns 3

The same column twice: pain scores from 3 to 6 — 6, 3 and 5.

Filled down a column
=COUNTIFS($A$2:$A$7, E2, $B$2:$B$7, F2)
Returns 1, 2, 0 in G2:G4

Each row reads its clinic and injury from columns E and F. Nobody has a hip injury, so the count is 0. 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

Adding two COUNTIFs instead

=COUNTIF(A2:A7, "Bayside")+COUNTIF(B2:B7, "Knee") returns 7: it counts the Bayside rows and the Knee rows separately. “Both must hold” is one COUNTIFS.

“6 or worse” written as >6

=COUNTIFS(A2:A7, "Bayside", C2:C7, ">6") returns 1, missing the patient on exactly 6.

Filling down without locking

Unlocked, the formula in G2 filled to G3 tests rows 3 to 8 and counts 1 Central Knee patient instead of 2: row 2 has slid out.

Ranges of different sizes

=COUNTIFS(A2:A7, "Bayside", B2:B6, "Knee") returns #VALUE!. Every range must cover the same rows.

FAQ

Can COUNTIFS count with OR?

Not in one condition. Add two: =COUNTIFS(B2:B7, "Knee")+COUNTIFS(B2:B7, "Back") returns 6.

Is the condition case-sensitive?

No. =COUNTIFS(A2:A7, "bayside", B2:B7, "knee") returns 2.

COUNTIFS with a single condition?

It works: =COUNTIFS(A2:A7, "Central") returns 3, the same as COUNTIF.

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