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

=AVERAGEIF($B$2:$B$7, E2, $C$2:$C$7)

Average the hours on the rows whose team matches E2. Like SUMIF, the range to average goes last; lock both ranges before you fill it down.

What the MO-211 task asks

An AVERAGEIF task asks for the average of one subset: “return the average Balance Due across the berths whose Dock is C”. One condition and an average is AVERAGEIF; two or more conditions is AVERAGEIFS.

Check whether every category in the task actually occurs in the data. When no row matches, AVERAGEIF has nothing to divide by and shows #DIV/0!, which is a real result, not a mistake in your formula.

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.

Support tickets
ABC
1TicketTeamHours
2T-1Billing4
3T-2Tech9
4T-3Billing2
5T-4Tech6
6T-5Sales5
7T-6Tech3
Averages (the video fills F2:F5)
EF
1TeamAvg hours
2Tech6
3Billing3
4Sales5
5Legal#DIV/0!
One condition on text
=AVERAGEIF(B2:B7, "Tech", C2:C7)
Returns 6

The three Tech tickets took 9, 6 and 3 hours: 18 divided by 3.

A condition on the averaged column
=AVERAGEIF(C2:C7, ">=6")
Returns 7.5

With no third argument, AVERAGEIF averages the cells it tested: 9 and 6.

Nothing matches
=AVERAGEIF(B2:B7, "Legal", C2:C7)
Returns #DIV/0!

No ticket belongs to Legal, so there is nothing to average.

Filled down a column
=AVERAGEIF($B$2:$B$7, E2, $C$2:$C$7)
Returns 6, 3, 5, #DIV/0! in F2:F5

One formula, filled down, with the ranges locked. Legal has no tickets. 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

Reading #DIV/0! as a broken formula

It means no row met the condition. Retyping the formula will not change it; check the category name against the data instead.

Leaving out the range to average

=AVERAGEIF(B2:B7, "Tech") tries to average the team names themselves and returns #DIV/0!. When the condition is on one column and the numbers are in another, the third argument is required.

Filling down without locking

Unlocked, =AVERAGEIF(B2:B7, E2, C2:C7) filled down moves both ranges a row at a time. In F3, Billing loses T-1 and averages 2 instead of 3.

The ranges in AVERAGEIFS order

AVERAGEIF tests first and averages last; AVERAGEIFS averages first. =AVERAGEIF(C2:C7, "Tech", B2:B7) tests the hours for the word Tech and returns #DIV/0!.

FAQ

Is the condition case-sensitive?

No. =AVERAGEIF(B2:B7, "tech", C2:C7) returns 6.

Can I use wildcards?

Yes. =AVERAGEIF(B2:B7, "B*", C2:C7) averages the teams starting with B — only Billing here — and returns 3.

How do I show 0 instead of #DIV/0!?

Only if the task asks for it. Test the count first: =IF(COUNTIF(B2:B7, "Legal")=0, 0, AVERAGEIF(B2:B7, "Legal", C2:C7)) returns 0.

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