Totals and counts function

COUNTIF

Count the rows that match one condition.

Purpose

Count the rows that meet one condition

Returns

A number: how many cells in the range match

Syntax

=COUNTIF(range, condition)

ArgumentRequiredWhat goes here
rangeRequiredThe column to test, like B2:B13.
conditionRequiredWhat counts as a match, like "Pastry" or ">10". A * stands for any run of characters, a ? for one.

How to use COUNTIF

COUNTIF takes the column to look at and what to look for. A condition is either a plain value, or an operator and a value inside one set of quotation marks: ">30", "<>Overdue".

The quotation marks around a comparison catch everybody once. >30 on its own is not a condition COUNTIF can read.

Referring to a cell rather than typing the value is what makes a summary block worth building: write the condition once against a label, and the block re-reads itself when the label changes.

Empty cells are never counted by a comparison, so a formula written over a generous block does not pick up the rows below the data.

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
=COUNTIF(C2:C9,"Overdue")How many invoices are overdue. A plain value needs no operator.5
=COUNTIF(D2:D9,">30")A comparison, with the operator inside the quotation marks.4
=COUNTIF(B2:B9,"Brightwell Paper")How many invoices this one supplier has open.2
=COUNTIF(C2:C9,"<>Overdue")Everything that is not overdue. Counting the complement is a good way to prove the first count was right, because the two have to add to the row count.3

Notes

  • Text matching ignores capitals, so "overdue" and "Overdue" count the same rows.
  • COUNTIF counts rows and never adds amounts. SUMIF is the one that adds.
Practise COUNTIF in Unit 07

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