ShareYourGroupShareYourGroupExcel Formulas

Statistical functions

COUNTIFS function in Excel

COUNTIFS counts the rows that meet several conditions at once.

COUNTIFS counts rows that satisfy every one of a set of conditions. It is how a list becomes a table of figures: how many students of each class fall in each grade band, how many orders of each status came from each city.

Syntax

=COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...)
ArgumentWhat it is
criteria_range1The first range to test.
criteria1The condition for the first range.
criteria_range2, criteria2, ...More pairs. A row is counted only if it passes every condition.

Examples

Each result below is what Excel itself showed for the formula on the sample sheet.

Sample sheet: Marks of eight students in three subjects. One Science mark is missing (cell D6 is empty).
ABCDE
1NameClassMathsScienceEnglish
2Asha8A788591
3Ravi8B455260
4Meena8A928879
5Kabir8B334138
6Tara8A6772
7Joy8B889084
8Neha8A546158
9Imran8B787369
Sample sheet: Twelve sales made by four salespeople in three regions.
ABCDEF
1DateSalespersonRegionProductUnitsAmount
205-Jan-2026AshaNorthNotebook201200
312-Jan-2026RaviSouthPen50500
420-Jan-2026MeenaNorthBag43000
502-Feb-2026AshaEastPen30300
614-Feb-2026KabirSouthNotebook15900
728-Feb-2026RaviNorthBag21500
803-Mar-2026MeenaEastNotebook402400
915-Mar-2026AshaNorthBag32250
1022-Mar-2026KabirSouthPen60600
1101-Apr-2026RaviEastNotebook251500
1218-Apr-2026MeenaNorthPen80800
1306-May-2026AshaSouthBag53750

How it works

Each pair names a range and a condition. COUNTIFS looks along each row and counts it only when all the conditions are true for that row. The conditions are joined by "and".

All the ranges must have the same number of rows and columns. They do not have to sit side by side, but they must be the same shape, or the result is #VALUE!.

The conditions are written as in COUNTIF: text and comparisons in quotation marks, cell references joined with &, wildcards allowed.

Bands

Two conditions on the same column give a range of values. The dependable pattern includes the lower end and excludes the upper, so that no value is counted in two bands or in none:

BandFormula
below 33=COUNTIFS(C2:C9,"<33")
33 to 59=COUNTIFS(C2:C9,">=33",C2:C9,"<60")
60 to 74=COUNTIFS(C2:C9,">=60",C2:C9,"<75")
75 and above=COUNTIFS(C2:C9,">=75")

Check your work: the bands should add up to the total count.

A cross table

With classes down the side and bands or categories across the top, one formula, copied across and down, builds a two-way summary:

=COUNTIFS($B$2:$B$9,$H2,$C$2:$C$9,">="&I$1)

This is a small version of what a PivotTable does. For large lists and many breakdowns, a PivotTable is quicker to build. For a fixed report layout, COUNTIFS gives you full control.

Dates

Count the rows in a period with a start and an end, as in the last example: on or after the first day, and before the first day of the next period. Writing the end as "before the next start" keeps the formula right for months of any length.

"Or" conditions

COUNTIFS has no "or". For "North or East", add two formulas, or use a list in curly brackets inside SUM:

=SUM(COUNTIFS(C2:C13,{"North","East"}))

Be careful adding when the conditions are on different columns: a row that meets both would be counted twice. Subtract the overlap, or use SUMPRODUCT.

Counting unique combinations

=COUNTIFS($A$2:$A$100,A2,$B$2:$B$100,B2) in a helper column shows how many times each pair of values occurs. Above 1 means the combination is repeated, such as the same invoice number entered twice for the same supplier.

Common mistakes

In Google Sheets

COUNTIFS is the same in Google Sheets.

Related functions

Every result on this page was calculated in Microsoft Excel (version 16.0, build 20326) on 12 November 2026, not typed by hand.

This is an independent help site. It is not connected with or approved by Microsoft. Excel and Microsoft 365 are trademarks of Microsoft Corporation, named here only to say which program a formula is for. The people and figures in the sample sheets are made up.