Totals and counts function

COUNTIFS

Count the rows where every condition holds.

Purpose

Count the rows where every condition holds

Returns

A number: how many rows match all the conditions at once

Syntax

=COUNTIFS(range1, condition1, [range2], [condition2], ...)

ArgumentRequiredWhat goes here
range1RequiredThe first column to test.
condition1RequiredWhat that column has to match.
range2OptionalThe next column to test.
condition2OptionalWhat that column has to match.

How to use COUNTIFS

COUNTIFS takes range and condition in pairs, and counts the rows where all of them hold. One pair behaves exactly like COUNTIF.

Every range has to cover the same rows. Testing C2:C9 against D2:D20 has no meaning and Excel refuses it rather than guessing which rows line up.

The conditions are joined by and, never by or. To count rows that are overdue or queried, add two COUNTIFS together, or count the complement instead.

Examples

Every result below is worked out by the same evaluator that marks your answers, on the sheet shown here.

Payables ageing — October.xlsxSheet1
Harbour Foods payables at 31 October 2026, with supplier terms alongside
ABCDEFGH
1InvoiceSupplierStatusDays overdueAmountSupplierTerms (days)
2INV-8801Brightwell PaperOverdue12940Ashgrove Catering30
3INV-8802Calder UtilitiesQueried471180Brightwell Paper30
4INV-8803Meridian FreightOverdue632450Calder Utilities14
5INV-8804Ashgrove CateringOn terms0405Meridian Freight45
6INV-8805Brightwell PaperOverdue38760Thornbury Print60
7INV-8806Thornbury PrintOverdue911320
8INV-8807Meridian FreightOn terms0580
9INV-8808Calder UtilitiesOverdue24215
FormulaResult
=COUNTIFS(C2:C9,"Overdue",D2:D9,">30")Overdue and more than thirty days old. Both have to hold.3
=COUNTIFS(C2:C9,"Overdue")With one pair it is COUNTIF, which is worth knowing when you are not sure yet how many conditions there will be.5
=COUNTIFS(B2:B9,"Brightwell Paper",E2:E9,">500")One supplier, and only the invoices worth chasing.2
=COUNTIFS(C2:C9,"Overdue")+COUNTIFS(C2:C9,"Queried")How an or gets written: two counts added, because the conditions inside one COUNTIFS are always joined by and.6

Notes

  • All the ranges must be the same size. This is the commonest reason a COUNTIFS refuses to calculate.
  • Conditions inside one COUNTIFS are always joined by and.
Practise COUNTIFS in Unit 15

A reference tells you what it does. A unit makes you use it.