3.5 · Conditional calculation: SUMIF(S), COUNTIF(S)

Level 3 · Advanced: pivot tables & charts

3.5Conditional calculation: SUMIF(S), COUNTIF(S)

Goal: aggregate selectively with SUMIF(S), COUNTIF(S), AVERAGEIF(S).
Estimated time: 14 min · self-paced reading · If you only have 5 min: read “The essentials in 30s” + the diagram.

The essentials in 30 seconds

  • One condition = IF: =SUMIF(criteria_range,criterion,sum_range) adds up what meets one criterion — COUNTIF counts, AVERAGEIF averages.
  • Several conditions = IFS: SUMIFS, COUNTIFS, AVERAGEIFS — and the range to aggregate comes first, before the criterion pairs.
  • Frozen KPI or exploration: IFS for a targeted figure of the dashboard, pivot table to cross freely — you combine both.

Running mini-case — Wassim freezes his three KPIs without recalculating them

Wassim, an accountant in Algiers, recalculates by hand each week the Algiers total, the number of South sales and the East average basket — and reverses two ranges once in three. He freezes three formulas: a SUMIF on the region, a COUNTIFS on region + month, an AVERAGEIF on the product. Verified against his pivot table, they no longer move: the dashboard displays the KPIs live, and the pivot table remains the exploration tool.

The same case returns in the course, the diagram, the script and the 48h challenge.

1. Aggregating under ONE condition: the ...IF functions

SUMIF adds the values that meet a criterion: =SUMIF(Sales[Region],"Algiers",Sales[Amount]) gives the total of Algiers sales. Likewise COUNTIF (count: =COUNTIF(Sales[Region],"South")) and AVERAGEIF (average). The criterion can be a text, a number or a comparison in quotes (">1000"), or even a wildcard ("Keyboard*").

The order in simple ...IF: first the criteria range, then the criterion, then the sum range. It is this order — different from the ...IFS — that traps: Wassim learned it by reversing two ranges and getting zero without understanding.

2. Several conditions: the ...IFS — and when to prefer a pivot table

For several criteria, you use the ...IFS variants: SUMIFS, COUNTIFS, AVERAGEIFS. Watch the order of the arguments: =SUMIFS(Sales[Amount],Sales[Region],"Algiers",Sales[Amount],">1000") — the range to sum comes first, followed by the (criteria_range, criterion) pairs. All ranges must be the same size.

These functions are perfect for targeted indicators in a dashboard (one cell = one figure). To explore freely (cross several dimensions, change the angle), the pivot table remains more flexible. Wassim combines both: pivot table to explore, SUMIFS to freeze KPIs — and he verifies each against the other.

Common misinterpretation: «SUMIF handles several conditions, and the order of the arguments is the same in ...IF and ...IFS». No, twice. SUMIF handles only ONE criterion — as soon as there are two, it is ...IFS, otherwise the result is wrong or zero. And the order reverses: in ...IF the sum range is last, in ...IFS it is first. One criterion = ...IF, several = ...IFS, range first.
Aggregating under condition Add, count, average only what meets one or more criteria SUMIF / IFSAdd under condition(s)+COUNTIF / IFSCount under condition(s)+AVERAGEIF / IFSAverage under condition(s) With ...IFS: the range to aggregate comes FIRST.
Add, count, average only what meets one or more criteria
Text version of the diagram (SEO / screen readers / translation): 1) One criterion: Wassim writes =SUMIF(Sales[Region],"Algiers",Sales[Amount]) instead of filtering then summing by hand. 2) Two criteria: he switches to ...IFS with the range to sum first — region Algiers AND amount > 1000. 3) Sharing: KPIs frozen by IFS in the dashboard, free exploration in the pivot table, verified against each other. Lesson: one criterion = ...IF, several = ...IFS, range first.

🔎 Concrete example — Total of Algiers sales above 1000

Wassim's «Sales» table (Region, Amount columns):

=SUMIF(Sales[Region], "Algiers", Sales[Amount])

=SUMIFS(Sales[Amount], Sales[Region], "Algiers", Sales[Amount], ">1000")

=COUNTIFS(Sales[Region], "South", Sales[Month], "2026-03")
=AVERAGEIF(Sales[Product], "Keyboard*", Sales[Amount])

Reading: SUMIF puts the criteria range first; SUMIFS puts the sum range first.

Lesson: the order of the arguments differs between IF and IFS — a classic source of error.

Section vocabulary

SUMIF
Adds the values meeting ONE criterion: (criteria_range, criterion, sum_range).

Simple example: Wassim's Algiers total: =SUMIF(Sales[Region],"Algiers",Sales[Amount]).

What it is not: a sum of two criteria with ...IF.

Reflex: one criterion = ...IF.

SUMIFS
Adds according to SEVERAL criteria: range to sum FIRST, then the pairs.

Simple example: Algiers AND > 1000 in one formula.

What it is not: the range to sum last as in ...IF.

Reflex: sum range first, pairs next.

COUNTIF(S)
Counts the cells meeting one / several criteria — without adding them.

Simple example: The number of South sales: =COUNTIF(Sales[Region],"South").

What it is not: a monetary total obtained by counting.

Reflex: count rows = COUNTIF.

AVERAGEIF(S)
Average of the values meeting one / several criteria — the targeted average basket.

Simple example: Wassim's East average basket.

What it is not: an average over the whole column without a criterion.

Reflex: targeted average = AVERAGEIF.

Criterion
The condition in quotes or as a reference: text, number, comparison, wildcard.

Simple example: ">1000", "Algiers", "Keyboard*".

What it is not: a comparison without quotes (>1000 bare).

Reflex: comparison and text = quotes.

In practice — Building targeted indicators

  1. Calculate a category's total with SUMIF.
  2. Count a category's records with COUNTIF.
  3. Combine two criteria with SUMIFS (watch the order).
  4. Compare the result to a pivot table's to verify.
You produce reliable conditional KPIs and know when to switch to a pivot table.

Ready-to-say script — explaining your KPIs (30 s)

«These three figures are frozen by formula: Algiers total with SUMIF, number of South sales with COUNTIFS, average basket with AVERAGEIF. In ...IFS, the range to sum comes first — I verified them against the pivot table, they are right to the cent.»

To say while presenting the dashboard; show the pivot table verification.

Copy-paste template — valid conditional KPIs

=SUMIF(Sales[Region], "Algiers", Sales[Amount])
=SUMIFS(Sales[Amount], Sales[Region], "Algiers", Sales[Month], "2026-03")
=COUNTIF(Sales[Region], "South")
=COUNTIFS(Sales[Region], "South", Sales[Month], "2026-03")
=AVERAGEIF(Sales[Region], "East", Sales[Amount])
=AVERAGEIFS(Sales[Amount], Sales[Region], "East", Sales[Product], "Keyboard*")

Freelancer

Three KPIs frozen by IFS, verified against the pivot table: your steering holds without reprocessing.

SME in Algiers

Wassim freezes Algiers total, South sales, average basket: the dashboard lives on its own.

Project team

Standardize: one criterion = ...IF, several = ...IFS, cross-check with the pivot table.

Beginner

This week: a SUMIF, a COUNTIF, then an ...IFS with two criteria.

✓ Best practices

  • One criterion → ...IF; several → ...IFS.
  • In ...IFS, the range to aggregate first.
  • Cross freely → pivot table; frozen KPI → IFS.

✗ Common pitfalls

  • Reversing the order of the arguments between ...IF and ...IFS.
  • Forgetting the quotes of a comparison criterion (">1000").
  • Using ...IF for two conditions (it handles only one).

Key takeaways

  • SUMIF/COUNTIF/AVERAGEIF: aggregate under ONE condition.
  • ...IFS variants for SEVERAL conditions.
  • In ...IFS, the range to aggregate comes first.
  • Pivot table to explore; IFS for targeted KPIs.

48h challenge — apply tomorrow

Freeze 3 KPIs (SUMIF, COUNTIFS, AVERAGEIF) and verify them against your pivot table to the cent.

Section exit checklist
  • My ...IF handle one criterion, my ...IFS several.
  • My ...IFS ranges are first, same size.
  • My KPIs are verified against the pivot table.
Self-assessment 1-5: do my KPIs survive an addition of rows?does each ...IFS have its sum range first?

Frequently asked questions

Why does my SUMIFS return an error / 0?

Often the order of the arguments: in ...IFS the range to sum is 1st, then the (criteria_range, criterion) pairs. Also check that the ranges are the same size and that the comparison criteria are in quotes (">1000").

SUMIFS or pivot table?

SUMIFS for a precise figure, reusable in a dashboard (one cell = one KPI). Pivot table to explore and cross dynamically. The two are complementary.

Check your understanding

How many conditions does SUMIF handle (without ...IFS)?

Additional resources (optional, to go further)

Level 3 examFresh, harder questions to test what you've learned