Counts the number of cells within a range that meet multiple criteria.

Syntax

COUNTIFS(range1, criteria1,range2, criteria2…)

Range1, range2, … are 1 to 127 ranges in which to evaluate the associated criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored.

Criteria1, criteria2, … are 1 to 127 criteria in the form of a number, expression, cell reference, or text that define which cells will be counted. For example, criteria can be expressed as 32, "32", ">32", "apples", or B4.

Remarks

Example

The example may be easier to understand if you copy it to a blank worksheet.

How to copy an example

  1. Create a blank workbook or worksheet.
  2. Select the example in the Help topic.

    Note Do not select the row or column headers.

    selecting an example from helpSelecting an example from Help

  3. Press CTRL+C.
  4. In the worksheet, select cell A1, and press CTRL+V.
  5. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
1
2
3
4
5
6
7
8
9
10
A B C D
Sales Person Exceeded Widgets Quota Exceeded Gadgets Quota Exceeded Doodads Quota
Davolio Yes No No
Buchanan Yes Yes No
Suyama Yes Yes Yes
Leverling No Yes Yes
Formula Description (result)
=COUNTIFS(B2:D2,"=Yes") Counts how many times Davolio exceeded a sales quota for Widgets, Gadgets, and Doodads (1)
=COUNTIFS(B2:B5,"=Yes",C2:C5,"=Yes") Counts how many sales people exceeded both their Widgets and Gadgets Quota (2)
=COUNTIFS(B5:D5,"=Yes",B3:D3,"=Yes") Counts how many times Leverling and Buchanan exceeded the same quota for Widgets, Gadgets, and Doodads (1)


See also: