Professional Documents
Culture Documents
COUNTIF Function
COUNTIF Function
COUNTIF Function
To count numbers or dates that meet a single test (such as equal to, greater than, less than, greater than or equal
to, or less than or equal to), use the COUNTIF function. In Excel 2007 and later, to count numbers or dates that
fall within a range (such as greater than 9000 and at the same time less than 22500), you can use the COUNTIFS
function. If you are using Excel 2003 or earlier, you can use the SUMPRODUCT function to count the numbers
that fall within a range (COUNTIFS was introduced in Excel 2007).
Example
The example may be easier to understand if you copy it to a blank worksheet.
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.
A B
1 Salesperson Invoice
2 Buchanan 15,000
3 Buchanan 9,000
4 Suyama 8,000
5 Suyama 20,000
6 Buchanan 5,000
7
Dodsworth 22,500
8
Formula Description (Result)
9
=COUNTIF(B2:B7,">9000") The COUNTIF function counts the number
of cells in the range B2:B7 that contain
numbers greater than 9000 (4)
10
=COUNTIF(B2:B7,"<=9000") The COUNTIF function counts the number
of cells in the range B2:B7 that contain
numbers less than 9000 (4)
11
=COUNTIFS(B2:B7,">=9000",B2:B7,"<=22500") The COUNTIFS function (available in Excel
2007 and later) counts the number of cells
in the range B2:B7 greater than or equal
to 9000 and are less than or equal to
22500 (4)
12
=SUMPRODUCT((B2:B7>=9000)*(B2:B7<=22500)) The SUMPRODUCT function counts the
http://office.microsoft.com/en-001/excel-help/count-numbers-or-dates-based-on-a-test-HP010342341.aspx 1/2
5/17/2014 Count numbers or dates based on a test - Excel
Function details
The COUNTIF function counts the number of cells within a range that meet a single criterion (condition) that you
specify.
=COUNTIF(range, criteria)
The COUNTIFS function applies multiple criteria to cells across multiple ranges and then counts the number of
times all criteria are met. You can use the COUNTIFS function to find multiple criteria on the same range, the same
criteria on multiple ranges, or multiple criteria on multiple ranges.
=COUNTIFS(criteria_range1, criteria1, criteria_range2, criteria2,…)
In the COUNTIFS example, criteria_range1 is B2:B7, criteria1 is ">=9000", criteria_range2 is again B2:B7, and
criteria2 is "<=22500". The same range of numbers is tested twice, but you could also test a number of different
ranges with different criteria for each.
The SUMPRODUCT function, as shown in the example, can be used in Excel 2003 and earlier, where COUNTIFS is
not available. In the SUMPRODUCT example, B2:B7>=9000 acts as the criteria_range1 and criteria1 pair, and
B2:B7<=22500 acts as the criteria_range2 and criteria2 pair that are used in the COUNTIFS example.
For more information, see COUNTIF function, COUNTIFS function, and SUMPRODUCT function.
Site Directory Contact Us Submit Feedback Legal Trademarks Privacy and Cookies Accessibility © 2014 Microsoft Corporation. All rights reserved.
http://office.microsoft.com/en-001/excel-help/count-numbers-or-dates-based-on-a-test-HP010342341.aspx 2/2