In the screen shot below, the following formulas are used in columns C, D and E, to look for a '1'.

The ISNUMBER function returns True or False, and the two minus signs (double unary) convert True to 1 and False to 0 (zero).

The FIND and SEARCH formulas found all 4 items that contain a '1'. The COUNTIF formula only found 3 items.

Use SUMPRODUCT with FIND or SEARCH

Instead of checking each row individually, use the SUMPRODUCT function with FIND or SEARCH, to get the total count for the list.

Example 1: Numbers

In this example, the formulas give a count of cells that contain a 1. The result is 4 in both cases.

Example 2: Letters

In the next example, the formulas give a count of cells that contain 'a'. FIND only counts the lower-case 'a' (1), and SEARCH counts both the upper-case 'A', and lower-case 'a' (2).

Count Cells 'Less Than' or 'Greater Than'

In this video, see how to use the COUNTIF function to count the number of items in a list that are over or under a specific amount. Written instructions are below the video:

Count Cells Greater Than or Equal to

You can use an operator with a criterion. In this example only the rows where the quantity is greater than or equal to ten will be counted.
  1. Select the cell in which you want to see the count (cell A12 in this example)
  2. Type an equal sign (=) to start the formula
  3. Type: COUNTIF(
  4. Select the cells that contain the values to check for the criterion. In this example, cells B1:B10 will be checked
  5. Type a comma, to separate the arguments
  6. Type the criterion. In this example, you're checking for rows where the quantity is greater than or equal to 10. The >= operator is used before the number, and the entire criterion is enclosed in double quotes: '>=10'
    Note: Even though this is a numerical criterion, it must enclosed in double quote marks.
  7. Type a closing bracket
  8. The completed formula is:
    =COUNTIF(B1:B10,'>=10')

  9. Press the Enter key to complete the entry
Note: Instead of typing the criterion in a formula, you can refer to a cell. For example, the formula in step 8 above could be changed to:
=COUNTIF(B1:B10,'>=' & B12)
if cell B12 contained the number -- 10.
Or, you could use a function as part of the criterion. For example:
=COUNTIF(A1:A10,'<'&TODAY()) ▲TOP

Count Cells Between 5 and 10

You can combine COUNTIF formulas, to count rows that are within a range of values. In this example, the formula will count rows where the quantity is between 5 and 10 (inclusive).
  1. Select the cell in which you want to see the count (cell A12 in this example)
  2. Type a formula to count rows greater than or equal to 5:
    =COUNTIF(B1:B10,'>=5')

  3. Type a minus sign
  4. Type a formula to count rows greater than 10:
    COUNTIF(B1:B10,'>10')

  5. The completed formula is:
    =COUNTIF(B1:B10,'>=5')-COUNTIF(B1:B10,'>10')
  6. Press the Enter key to complete the entry
Note: Instead of typing the criterion in a formula, you can refer to a cell. For example, the formula in step 8 above could be changed to:
=COUNTIF(B1:B10,'>=' & B12) -
COUNTIF(B1:B10,'>' & C12)
if cell B12 contained the number -- 5 and cell C12 contained the number -- 10. ▲TOP

Change Operator for COUNTIF Function

Instead of typing the operator into the COUNTIF formula, as shown above, you can create a list of all possible operators, and select one from a drop down list. Then, refer to that operator in the formula.
This video shows the steps for setting up the formula, and the written instructions are below the video.

Create a Drop Down List of Operators

To create a drop down list operators:
  1. On a different sheet in the workbook, type a list of operators in a column.
  2. Select the cells in the list, and name that list as OpList.
  3. On the main sheet, select the cell where you want the drop down list -- cell E6 in this example
  4. Use the data validation command to create the drop down list, based on the named range -- OpList

Use the Drop Down List

Change your COUNTIF formula, to replace the typed operator with a reference to the cell with the drop down list.
=COUNTIF(B2:B11,E6&F6)
Then, select one of the operators from the drop down list in cell E6, and the formula result will change.
Excel Countif Multiple Criteria

Count cells that match multiple criteria

This video shows how to use the COUNTIFS function to count cells based on multiple criteria.
Written instructions are below the video:
--Count multiple criteria with COUNTIFS
--Count multiple criteria with SUMPRODUCT
--Count all dates in a specific month and year

Count Cells that Match multiple criteria

In Excel 2007 and later versions, you can use the COUNTIFS function to count rows that meet two or more criteria. In this example only the rows where the item is 'Pen' and the quantity is greater than or equal to ten will be counted.
  1. Select the cell in which you want to see the total
  2. Type an equal sign (=) to start the formula
  3. Type: COUNTIFS(
  4. Select the cells that contain the values to check for the first criterion. In this example, cells A2:A10 will be checked
  5. Type a comma, and the first criterion: 'Pen'
    Note: Because this is a text criterion, it is enclosed in double quote marks.
  6. To start the next set of criteria, type a comma
  7. Select the cells that contain the values to check for the second criterion. In this example, cells B2:B10 will be checked
  8. Type a comma, and the second criterion: '>=10'
    Note: Because this criterion includes operators, it is enclosed in double quote marks. To count rows where the quantity is equal to 10, only the number 10 would be required.
  9. Finish with a closing bracket: )
  10. The completed formula is shown below.
  11. Press the Enter key to complete the entry
Note: Instead of typing the criterion in a formula, you can refer to a cell, as shown in the second formula below. If using operators, enclose them in double quote marks.
Use typed criteria:
or cell references:

Count cells that match multiple criteria -- SUMPRODUCT

In this example, the SUMPRODUCT function is used to count the rows where the item is 'Pen' and the quantity is greater than or equal to ten. This solution will work in older versions of Excel, where there COUNTIFS function is not available.
  1. Select the cell in which you want to see the total
  2. Type an equal sign (=) to start the formula
  3. Type: SUMPRODUCT(--(
  4. Select the cells that contain the values to check for the first criterion. In this example, cells A2:A10 will be checked
  5. Type the first criterion: ='Pen'
    Note: Because this is a text criterion, it is enclosed in double quote marks.
  6. Type ),--(
  7. Select the cells that contain the values to check for the second criterion. In this example, cells B2:B10 will be checked
  8. Type the second criterion: >=10
    Note: Because this is a numerical criterion, it isn't enclosed in double quote marks.
  9. Finish with closing brackets: ))
  10. The completed formula is shown below.
  11. Press the Enter key to complete the entry
Note: Instead of typing the criterion in a formula, you can refer to a cell, as shown in the second formula below ▲TOP
Use typed criteria:
=SUMPRODUCT(--(A2:A10='Pen'),--(B2:B10>=10))
or cell references:
=SUMPRODUCT(--(A2:A10=D2),--(B2:B10>=E2))

Count All Dates in Specific Month and Year

In this example, there is a date in cell A2, and the order list has dates in cell A5:A26. The following SUMPRODUCT function is in cell D2, and it counts all the dates that have the same month and year as the date in cell A2.
=SUMPRODUCT((MONTH(A5:A26)=MONTH(A2))*(YEAR(A5:A26)=YEAR(A2)))

Count Rows in a Filtered List

After you filter the rows in a list, you can use functions to count only the visible rows.

Count Rows in a Filtered List With SUBTOTAL

After you filter the rows in a list, you can use the SUBTOTAL function to count the visible rows.
  1. Apply an AutoFilter to the table. There are instructions here -- AutoFilter Basics
  2. Filter at least one of the columns in the table. In this example, the first column has been filtered for Binders.
  3. Select the cell immediately below the column you want to sum.
  4. Click the AutoSum button on the Excel's Standard toolbar.
  5. A SUBTOTAL formula will be automatically inserted, totalling the visible cells in the column
  6. To Count all the non-empty cells in column D, use a 3 as the first argument:
    =SUBTOTAL(3,D2:D10)
  7. Press the Enter key to complete the formula entry.
  8. Note: To subtotal rows which have been either manually hidden or filtered, use 103 as the function number, instead of 3:
    =SUBTOTAL(103,D2:D10)
    ▲TOP

Count Rows in Filtered List With AGGREGATE

After you filter the rows in a list, you can use the AGGREGATE function to count the visible rows. This function was introduced in Excel 2010, and is similar to SUBTOTAL, but it has 19 functions, compared to SUBTOTAL's 11 functions. Another advantage is that it can ignore errors, as well as hidden rows.
  1. Apply an AutoFilter to the table. There are instructions here -- AutoFilter Basics
  2. Filter at least one of the columns in the table. In this example, the first column has been filtered for Binders.
  3. Select the cell in which you want to see the total -- cell B1 in this example
  4. To start the formula, type: =AGGREGATE(
  5. In the list of function numbers, double-click on 3-COUNTA, then type a comma
  6. In the list of option numbers, double-click on 3 - Ignore hidden rows, error values, nested SUBTOTAL and AGGREGATE functions, then type a comma
  7. Select the cells that contain the values to check for the first criterion. In this example, the Total column in the table is selected.
  8. Type a closing bracket, then press the Enter key to complete the formula entry.
    =AGGREGATE(3,3,Table1[Total])
The two visible numbers are counted, and the error in cell D9 is ignored.

Count Specific Items in a Filtered List

Laurent Longre created a formula that lets you work with visible rows after a filter. For information see, Power Formula Technique in this article at John Walkenbach's web site:
https://j-walk.com/ss/excel/eee/eee001.txt
Incorporating that technique, SUMPRODUCT can be used to count visible items in a filtered table. In the following example, column D has been filtered for amounts greater than 100. The following formula will count the number of visible rows that contain 'Pen' in column A.
  1. From the drop down list in cell D1, select Custom.
  2. Filter for rows greater than 100.
  3. In cell A12, type: Pen
  4. In cell B12, enter the following formula:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(A1:A10,ROW(A1:A10)
-MIN(ROW(A1:A10)),1)), --(A1:A10=A12))
  1. Press the Enter key to complete the formula entry. ▲TOP

Count Unique Items in a Filtered List

In the Excel Expert Newsletter (issue 20, July 8, 2001), there is a formula to count unique items in a filtered list. In this example, the list is filtered for the Central region, and unique items in column D are counted.
  1. The LineVal column is a named range -- Rge
  2. The name unRge is defined with the formula: =IF(SUBTOTAL(3,OFFSET(Rge,ROW(Rge)-MIN(ROW(Rge)),1)),Rge,')
  3. In cell C2, enter the following formula:
=SUM(N(IF(ISNA(MATCH('',unRge,0)),MATCH(Rge,Rge,0),
IF(MATCH(unRge,unRge,0)=MATCH('',unRge,0),0,
MATCH(unRge,unRge,0)))=ROW(Rge)-MIN(ROW(Rge))+1))
  1. This is an array formula, so press Ctrl+ Shift + Enter to complete the formula. ▲TOP

Download the COUNT Sample Files

1. Download zipped Count Functions sample workbook. The zipped file is in xlsx format, and does not contain any macros.
2. Download the 7 Ways to Count sample workbook, to follow along with the 7 Ways to Count video. The zipped file is in xlsx format, and does not contain any macros.
3. Download the Count Unique Items in Filtered List workbook. The zipped file is in xlsx format, and does not contain any macros.

More Function Tutorials