Practice: conditional totals

Conditional totals · About 6 minutes

Practice: conditional totals

This is a mix. Each task needs a different function, so read what it asks for first: a total, a count or an average.

Then count the conditions. One condition: SUMIF, COUNTIF or AVERAGEIF. Two or more: SUMIFS, COUNTIFS or AVERAGEIFS.

Questions like these are common in office and data-entry tests.

Part of Plus

Free during our founding launch: sign in to unlock this lesson's exercises, the timed practice sets and the rest of Plus. The free lessons stay free, with no account needed.

What this practice covers

This practice mixes the conditional functions, the way a work task or an office test does. Each task asks for a total, a count or an average of only some rows, and you choose the function.

Two questions pick it for you. What does the task want: a total, a count or an average? And how many conditions are there? A condition is a test each row passes or fails, like Type is Veg.

The formulas you'll use

=SUMIF(range, criteria, [sum_range])

use it for
A total with one condition. The range to add comes last.

=SUMIFS(sum_range, criteria_range1, criteria1, ...)

use it for
A total with two or more conditions. The range to add comes first.

=COUNTIF(range, criteria)

use it for
How many rows pass one condition. COUNTIFS takes more pairs.

=AVERAGEIF(range, criteria, [average_range])

use it for
An average of the rows that pass one condition. AVERAGEIFS takes more, with the range to average first.

A worked example

A market logs the kg of each crop. In C9, find the average kg of the crops whose type is in A9.

A market logs the kg of each crop. In C9, find the average kg of the crops whose type is in A9.
ABC
1CropTypeKg
2AppleFruit12
3KaleVeg4
4PearFruit9
5LeekVeg6
6PlumFruit7
7CornVeg11
8
9Veg7
C9=AVERAGEIF(B2:B7,A9,C2:C7)Look down B2 to B7 for the type in A9, and average the kg in C2 to C7 on those rows: (4 + 6 + 11) / 3 = 7.

Mistakes to watch for

A count where the task wanted a total

Read the task again. "How many" means COUNTIF; "how much" or "add up" means SUMIF.

The second condition is ignored

SUMIF, COUNTIF and AVERAGEIF take one condition only. For two, switch to SUMIFS, COUNTIFS or AVERAGEIFS.

The total adds the wrong column

Check where the range to add goes: last in SUMIF and AVERAGEIF, first in SUMIFS and AVERAGEIFS.

Which one fits the task?

Start with the result: total means SUMIF or SUMIFS, count means COUNTIF or COUNTIFS, average means AVERAGEIF or AVERAGEIFS. Then count the conditions: one takes the plain version, two or more take the one ending in S.

All six work the same way in Excel and Google Sheets, so the skill carries over to either.

Questions people ask

When should I use SUMIFS instead of SUMIF?

When you need more than one condition, such as one customer in one month. For a single condition, either works.

How do I choose between a total, a count and an average?

Read what the question asks: "how much" means SUMIF or SUMIFS, "how many" means COUNTIF or COUNTIFS, and "on average" means AVERAGEIF.

Are SUMIF and COUNTIF asked in Excel job tests?

Yes, they are common in office, accounts and data-entry tests, often as "total the sales for one region" or "count the overdue invoices".

Do I need Excel to do these exercises?

No. The grid on this page works in your browser and checks each formula. The same formulas work in Excel and Google Sheets.

Theme