🎓 Zero-to-Hero masterclass

Conditional Aggregation

Add, count and average only the rows that match your rules — SUMIFS and its family, the analyst's daily bread, made simple.

8 functions2 maps9 live drills
🟢 Foundation 🗺️ Visual map 🟡 Deep dive 🔴 Traps & hacks 💻 Sandbox
🟢

The Foundation

Level 1 · the hook & basics

Imagine a busy kirana shop at closing time. The owner does not want the total of every bill in the drawer — she wants the total of just the bills that follow a rule. Add up only the North sales. Count only the bills over ₹500. That is conditional aggregation: adding, counting or averaging only the rows that pass your test.

Picture SUMIFS as a smart cashier. You hand her a stack of bills and a short list of rules — North region, over ₹500, month of January — and she rings up only the bills that obey every rule. A bill that breaks even one rule is quietly set aside. Each rule is a filter, and a row must pass all of them to be counted.

The whole family works this way, and the name tells you the job it does:

  • SUM… adds a column of ₹ amounts.
  • COUNT… tallies how many rows match — no adding, just counting heads.
  • AVERAGE… works out the mean of the matching rows.

And the ending tells you how many rules it takes: …IF handles one rule; …IFS (with the extra S) handles several. So SUMIF totals with one rule, SUMIFS totals with many, COUNTIFS counts with many, and so on across the family.

Two little words to learn. A range is the column you look in (say the Region column), and the criteria is the rule itself (say "North"). Give Excel the range and the rule, and it does the filtering for you — instantly, whether the sheet has ten rows or ten thousand.

The family in one breath: what you want — sum, count or average — picks the word; how many rules — one or many — picks the ending: plain IF for one, IFS for many.
🗺️

Visual Architecture

the whole system on one screen

Two quick pictures: a map of the whole family, then a decision tree for picking the right one.

🧠 The conditional-aggregation familyone map of the whole clan

Conditional aggregation

SUMIF and SUMIFS

one rule or many

total by filter

COUNTIF and COUNTIFS

how many rows match

AVERAGEIF and AVERAGEIFS

mean of the matches

MAXIFS and MINIFS

biggest or smallest match

Criteria syntax

exact text

numbers and compares

wildcards star and ques

value from a cell

View Mermaid.js source
mindmap
  root((Conditional aggregation))
    SUMIF and SUMIFS
      one rule or many
      total by filter
    COUNTIF and COUNTIFS
      how many rows match
    AVERAGEIF and AVERAGEIFS
      mean of the matches
    MAXIFS and MINIFS
      biggest or smallest match
    Criteria syntax
      exact text
      numbers and compares
      wildcards star and ques
      value from a cell
🧭 Which function do I use?what you want, then how many rules

a total

a headcount

an average

one rule

many rules

one rule

many rules

one rule

many rules

What are you working out

SUM family

COUNT family

AVERAGE family

SUMIF

SUMIFS

COUNTIF

COUNTIFS

AVERAGEIF

AVERAGEIFS

View Mermaid.js source
flowchart TD
  A[What are you working out] -->|a total| B[SUM family]
  A -->|a headcount| C[COUNT family]
  A -->|an average| D[AVERAGE family]
  B -->|one rule| B1[SUMIF]
  B -->|many rules| B2[SUMIFS]
  C -->|one rule| C1[COUNTIF]
  C -->|many rules| C2[COUNTIFS]
  D -->|one rule| D1[AVERAGEIF]
  D -->|many rules| D2[AVERAGEIFS]
🟡

The Deep Dive

Level 2–3 · core mechanics → expert edge

Every function here follows one simple shape: tell Excel where to look, then what to look for. The only wrinkles are the argument order and how you spell out the rule. Let us take them one at a time, with a little sales sheet in mind.

SUMIF — one rule. Its shape is SUMIF(range, criteria, [sum_range]). The range is the column Excel checks, the criteria is the rule, and the optional sum_range is the column it actually adds up. If you leave out sum_range, Excel simply adds the very column it checked — ideal for =SUMIF(B2:B7,">40"), which totals the amounts that are over 40. When the rule lives in one column but the money lives in another, give all three: =SUMIF(A2:A7,"North",C2:C7) checks Region in column A and adds the ₹ from column C.

Mind the swap! SUMIF puts the range to check first and the money column last. SUMIFS flips it — the SUM range comes FIRST, then the range-and-rule pairs. Muddle the two and Excel cheerfully totals the wrong column.
FunctionArgument orderMoney column is…
SUMIFrange, criteria, [sum_range]last — and optional
SUMIFSsum_range, range1, criteria1, range2, criteria2, …first — and required

SUMIFS — many rules. Its shape is SUMIFS(sum_range, criteria_range1, criteria1, criteria_range2, criteria2, …). The column of ₹ you want totalled goes first; after that come pairs — a column to check, then the rule for it. Add as many pairs as you like. A row is added only if it passes every pair — that is AND logic. There is no OR hiding in here: each extra pair makes the filter stricter, never looser.

Start with the money. =SUMIFS(C2:C9 — the ₹ column you want totalled.
Add the first filter — the Region column, then its rule. , A2:A9, "North"
Add the second filter — the Month column, then its rule. , B2:B9, "Jan"
Close the bracket. The finished formula =SUMIFS(C2:C9,A2:A9,"North",B2:B9,"Jan") totals only the North sales booked in January.

COUNTIF and COUNTIFS count rows instead of adding them, so there is no money column to fuss over. COUNTIF(range, criteria) answers "how many?" for one rule — =COUNTIF(A2:A9,"North") tells you how many North orders exist. COUNTIFS(range1, criteria1, range2, criteria2, …) takes several rules: =COUNTIFS(A2:A9,"North",C2:C9,">500") counts the North orders worth over ₹500.

AVERAGEIF and AVERAGEIFS return the mean of the matching rows. Watch the order quirk: AVERAGEIF(range, criteria, [average_range]) mirrors SUMIF (the check-range comes first), while AVERAGEIFS(average_range, range1, criteria1, …) mirrors SUMIFS (the averaged column comes first). So =AVERAGEIF(A2:A9,"North",C2:C9) gives the average North order value. If no row matches, the AVERAGE family returns a #DIV/0! error — there is simply nothing to divide.

MAXIFS and MINIFS round out the clan (Excel 2019 and Microsoft 365 onwards). They pick out the largest or smallest matching value and read exactly like SUMIFS: MAXIFS(max_range, range1, criteria1, …). For instance =MAXIFS(C2:C9,A2:A9,"North") returns the biggest single North sale, and MINIFS the smallest. Same pairs, same AND logic — just max or min instead of a total.

Writing the criteria. The rule is the fiddly part, so keep this cheat-sheet close. Text and comparison rules go inside double quotes; to compare against a value that lives in a cell, join the operator to the cell reference with an &.

You want…WriteWhat it means
Exact text"North"region is exactly North — not case-sensitive
A plain number50 or "50"equals 50
Greater than">500"strictly over 500
At most"<=50"50 or less
Not equal to"<>0"anything except zero
Starts with A"A*"* stands for any run of characters
A five-character code"?????"? stands for exactly one character
A value from a cell">"&E1over whatever number E1 holds

Two wildcards do the heavy lifting. * stands for any number of characters — so "A*" catches every name starting with A, and "*ltd*" catches every firm with "ltd" anywhere in the name. ? stands for exactly one character, handy for fixed-length codes. The cell trick — ">"&E1 — is pure gold: park a threshold in a cell, and the whole report re-totals the instant you change that one number.

Put it together and a single column of formulas becomes a living dashboard. Here are four regions, each totalled with one SUMIFS:

Total sales by region (₹ thousand) 210 North 160 West 140 South 90 East
🔴

Expert Traps & Hacks

Level 4 · where 90% slip — and the exam edge

Conditional aggregation is easy to write and easy to write wrongly — the sheet rarely warns you, it just returns a confidently wrong number. Here are the slips that catch nearly everyone, and the pro moves that set your work apart.

The classic swap. =SUMIFS(A2:A9,"North",C2:C9) reads like SUMIF, but SUMIFS wants the sum column first. The right order is =SUMIFS(C2:C9,A2:A9,"North") — money, then the range-and-rule pair. If a total looks wildly off, check this before anything else.
Forgetting the quotes. Any rule that contains an operator or text must be quoted. =SUMIF(B2:B9,>40) throws an error; write =SUMIF(B2:B9,">40"). A bare number like 40 may go unquoted, but the moment you add >, < or letters, wrap it in double quotes.
Gluing a cell reference wrongly. To read a threshold from a cell, the operator stays inside the quotes and the cell stays outside: ">"&E1. Writing ">E1" makes Excel hunt for the literal text ">E1", and >&E1 without quotes simply errors. Operator in quotes, ampersand, then the cell.
Mismatched range shapes. In SUMIFS and its cousins, every range must be the same size — same rows, same height. If your sum column is C2:C9 but a criteria column is A2:A8, Excel returns #VALUE!. Select whole matching blocks (or entire columns) and the problem never appears.
Pro hack — put your rules in cells. Never bury a rule inside the formula. Drop "North" in one cell and 500 in another, then write =SUMIFS(C2:C9,A2:A9,F1,D2:D9,">"&F2). Now the whole report recalculates the moment you type a new region or a new threshold — one formula, endless questions answered. Add a drop-down list to those cells and you have an instant mini-dashboard.
Pro hack — SUMIFS as a two-way table. Write one SUMIFS with region names down the side and months across the top, lock the references with $ in the right places, and drag it across the grid. You have hand-built a summary table that never needs a refresh — a pivot table you fully control.
💻

Interactive Sandbox — Formula Sandbox

type a real formula — the cell fills and turns green

Type a real formula into the bar; the target cell fills in and turns green when your answer matches. Work top to bottom — each drill adds one new idea.

🧮 Formula Sandboxtype it · run it · green when right
0Correct
0Streak
🇬🇧 The complete Excel pathThis module is one of ten. Work through them in order — Grid Basics to Dynamic Arrays — then keep the Function Atlas open as your desk reference. All 10 Excel modules →