|
Home > Formulas > Statistical > Count 7 Ways to Count in Excel - Examples
|

To see a quick overview of 7 ways to get a total count of cells in Excel, watch my 77-second video.
There are written steps for each count function example, below the video.
The COUNT function will count cells that contain numbers.
For example, in the list shown below, there are 2 cells with numbers -- A2 and A4 (dates are stored as numbers in Excel).

To count the numbers, I used this COUNT formula in cell C2:
The formula result is 2, because the text value and blank cell are not counted.

The Excel COUNTA function will count cells that are not empty.
For example, in the list shown below, there are 2 cells with numbers -- A2 and A5. Cell A3 contains text, and cell A5 is blank (no data)

To count the cells that contain any type of data, I used this COUNTA formula in cell C2:
The formula result is 3, because the blank cell is not counted.
The COUNTBLANK function will count the following:
For example, in the list shown below, there are 2 cells with numbers -- A2 and A5. Cell A3 contains text, and cell A5 is blank (no data)

To count the blank cells, I entered this formula in cell C2:
In the example shown above, the formula result is 1, because there is one completely empty cell in the range A2:A5.
The COUNTIF function will count cells that match one specific criterion. For example, count cells that contain an exact match for the text string, "Pen".

To count the cells that match the criterion, I entered this formula in cell D2:
In the example shown above, the formula result is 2, because there are two cells that match the criterion in cell D1.
Learn More: Go to more examples for counting specific items.
In Excel, you can use wildcard characters, such as an asterisk (*), or question mark (?), to count cells that are a partial match for a criterion.

Here's the formula in cell D2, and it refers to the criterion cell, D1:
The formula result is 3, because there are 3 items that contain the string "pen", exactly or partially.
Learn More: Go to more examples for counting specific items.
The COUNTIFS function counta cells that match one or more specific criteria. In the screen shot below, the formula uses 2 criteria:

Here's the formula in cell D3, and it refers to the two criteria cells):
The formula result is 1, because there is one pen item with a quantity greater than or equal to 6.
Learn More: Go to more examples for counting with multiple criteria.
After you filter the rows in a list, you can use the SUBTOTAL function to count the visible rows in the filtered data. SUBTOTAL ignores hidden items, and only counts the visible items.

In the screen shot shown above, column A is filtered, to show Pen and Pencil items only. In cell D1, I entered this formula, to count the visible cells in the Qty column:
The formula result is 3, because there are 3 visible numbers in column B.
Learn More: Go to more examples for counting in a filtered list.
Don't miss my monthly Excel newsletter! You'll get quick tips, article links, and a bit of fun. Add your email, and click Sign Up.
Next, when you get my reply, click the Confirm button. I add this step to protect you from spam!
In this section, you'll find notes on Excel functions used in the 7 ways to count. These things are nice to know, but not essential, so you can skip this section, and get back to work. Or dive in, for some extra Excel fun and knowledge!
The COUNT function syntax has one required argument, and up to 255 additional items, that are optional
For the COUNT function arguments, you can use any combination of valid cell references, or typed values. For example:
The COUNTA function syntax has one required argument, and up to 255 additional items, that are optional
COUNTA counts the following items:
However, COUNTA does not count blank (empty) cells
| ▶ |
Tip: If COUNTA appears to be counting blank cells, check the troubleshooting suggestions on the Fix Blank Cells page. |
The COUNTBLANK function argument syntax
is:
=COUNTA(value1, [value2],...]) .
The arguments (e.g. value1) can be cell references, or values typed
into the formula
In the COUNTIF function syntax, there are two required arguments:
=COUNTIF(range, criteria)
In Excel, you can use wildcard characters, such as an asterisk (*), or question mark (?), to count cells that contain a partial match for a criterion.
The asterisk (*) wildcard character represents any number of characters in that position, including zero characters.
In the example shown below, cell D1 has the wildcard criteria: *n*l*
In cell D2, the COUNTIF formula returns a count of 1
There is 1 item that contains an n, with an i, somewhere after the n.

The question mark (?) wildcard character represents one characters in that position.
In the example shown below, cell D1 has the wildcard criteria: ?e*
In cell D2, the COUNTIF formula returns a count of 3
There are 3 items that have 1 character, followed by an e, then any number of characters.

The tilde (~) wildcard character lets you search for characters that are used as wildcards.
In the example shown below, cell D1 has the wildcard criteria: *~**
In cell D2, the COUNTIF formula returns a count of 2
There are 2 items that have any number of characters, followed by an asterisk (*), then any number of characters.

In the COUNTIFS function syntax, there are two required arguments:
=COUNTIFS(criteria_range1, criteria1,...)
Note: Additional pairs of criteria ranges and criteria can be included in the formula.
In the SUBTOTAL function syntax, there are two required arguments:
SUBTOTAL(function_num,ref1,[ref2],...)
In the example shown above, I used function number 102, which tells Excel to use the COUNT function.
There are two sets of function numbers, in the SUBTOTAL drop-down list.
a) Function Numbers 1 to 11

b) Function Numbers 101 to 111

Count Criteria in Other Column
Count Cells With Specific Text
Last updated: January 21, 2025 3:18 PM