# Count Specific Items in Excel List

See how to count specific items in an Excel list with formula, for text, numbers, dates. Short step-by-step video, free Excel workbook, written steps, screenshots

## Video: Count Specific Items in List

This video tutorial shows how to use the COUNTIF function to count the number of cells that contain a specific string of text, such as "Pen". You can also find text that is part of a cell -- how many orders were placed for any kind of pen, such as "Gel Pen", "Pen" or even a "Pencil"?

There are written steps below the video, and you can read the video transcript at the bottom of this page.

## Excel COUNTIF Function

In Microsoft Excel, you can use the COUNTIF function to count cells that meet one criterion.

Note: To count cells based on multiple criteria, use the Excel COUNTIFS function.

### COUNTIF Arguments

With the COUNTIF function syntax, there are 2 required arguments:

1. range - cells to check for criteria
2. criteria - criteria to match - typed in the formula, or refer to a cell

## COUNTIF Warnings

Here are a couple of warnings about the COUNTIF function limitations, before you use this function in your Excel spreadsheet.

## Match Specific Text Exactly

In Excel, sometimes you need to count specific items in list. In this example, there is a list of items that were ordered, and we want to count number of occurrences for the Pen orders only.

Follow these steps to create a COUNTIF formula to count the pen orders:

1. Select a cell for your formula - cell D4 in this example)
2. Type an equal sign (=) to start the formula
3. Type:   COUNTIF(
4. Select the range of cells where the items are listed - cells A2:A10 in this example
• NOTE: If your list is in a named Excel table, the formula will show the table name and column name -- =COUNTIF(tblExact[Item]
5. Type a comma, to separate the arguments
6. Type the value that you want to match. In this example, the value is text, it's typed inside double quote marks:   "Pen"
• Note: You can use upper or lower case for the criteria-- COUNTIF is not case sensitive
7. Type a closing bracket, and press Enter

### Completed COUNTIF Formula

For a named table, the completed formula shows the table name (tblExact) and column name (Item):

• =COUNTIF(tblExact[Item], "Pen")

and for a worksheet list, the formula shows the cell reference:

• =COUNTIF(A2:A10, "Pen")

In this screenshot, you can see the result of the above formula in cell D4. There are 4 orders with an exact match for the "pen" criterion.

## Match Text Anywere in Cell

Instead of counting exact matches in an entire cell, you might want to count cells where specific text is anywhere in the cell - matching the entire cell value, or any part of the cell value.

• Note: COUNTIF cannot find numbers within real numbers

As in the previous example, we'll count the "Pen" orders. This time, the formula will have asterisk (*) wildcard characters before and after the text string. This wildcard represents any number of unknown characters, or no characters.

As a result, all the Pen, Gel Pen, and Pencil orders will be counted, because they contain the string "pen".

1. Select a cell for your formula - cell D4 in this example)
2. Type an equal sign (=) to start the formula
3. Type:   COUNTIF(
4. Select the cells where the items are listed - cells A2:A10 in this example
• NOTE: If your list is in a named Excel table, the formula will show the table name and column name -- =COUNTIF(tblExact[Item]
5. Type a comma, to separate the arguments
6. Inside double quotes, type the value that you want to match, with asterisk (*) wildcard character before and after the text:   "*Pen*"
• Note: You can use upper case or lower case -- COUNTIF is not case sensitive
7. Type a closing bracket, and press Enter

### Completed Formula With Wildcards

For a named table, the completed formula shows the table and column names:

• =COUNTIF(tblExact[Item], "*Pen*")

and for a worksheet list, the formula shows the cell reference:

• =COUNTIF(A2:A10, "*Pen*")

## Use Cell References

To make your formulas more flexible, and easier to maintain, you can type the criteria text that you want to count in an Excel worksheet cell.

Then, in the formula, refer to the cell where you typed the criteria text.

For example, here is the formula to match a specific item, with a reference to cell E7, where the criteria text, "pen", was typed.

• =COUNTIF(tblExact[Item], E7)

You can use a cell reference with wildcard characters too. Use the & (ampersand) operator to join the wildcard characters to the cell reference.

• =COUNTIF(tblWild[Item], "*" & E7 & "*")

## Video Transcript - Count Specific Items

Here is the transcript of the video above - Count Specific Items in Excel List.

__________

VIDEO TRANSCRIPT

In Excel, we have a list of sales orders and we would like to count how many orders there was a pen in the order. my list is from A1 to A10, and I'd like to count pen in that list.

to do that, I can use the COUNTIF function. in this cell I start with an equal sign and type COUNTIF, and an open bracket.

#### First Argument

The first argument is which range I would like it to check.

I'm going to select A1 to A10.

I'll type a comma, to end that argument.

#### Second Argument

The next argument is the criteria. What exactly do I want it to count?

I'm looking for a text string, so in double quotes, I type a double quote and then pen and a closing quote and a closing bracket.

When I press Enter, it found 4 pen items in that list.

So 1, 2, 3, 4, it found all 4 of our pen items.

#### Item Name Contains "Pen"

If we have on another worksheet, the same list. Here I've got pen, pencil, gel pen.

Maybe I'd like to find anything that has pen as part of the item name.

So not exactly pen, I don't want to count just the pens, but I'd like to include the gel pen and even a pencil.

#### Start COUNTIF Formula

Here, again, I'll use COUNTIF.

• I'll start with an equal sign, COUNTIF, and an open bracket, and then the range is A1 to A10, type a comma.
• For this, I want it to include anything that has pen in it.
• I'll type my double quote mark and then an asterisk.
• On my keyboard that was Shift 8.
• That's a wild card character that represents any number of characters or no characters.
• Then the text I'm looking for. I can use upper or lowercase there
• Another asterisk, another double quote and a closing bracket.

It's going to look for anything that contains the letters, P-E-N in a string.

• There can be anything before that or nothing.
• And there can be anything after those three letters or nothing.

#### Formula Result

And when I press Enter we get 6. So one, two, three, four, five, six.

It found anything that contained that string of characters, P-E-N and the case didn't matter.

## Get the Sample File

To see all the COUNTIF examples, download the Count Specific Items sample workbook now. The zipped file is in xlsx file format, and does not contain any macros.

## More Function Tutorials

Compare 2 Lists

COUNT / COUNTIF

Count Criteria in Other Column

Count Cells With Specific Text

Count Specific Items in Cell

AVERAGE

SUM / SUMIF

Last updated: November 9, 2022 2:45 PM