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
This video shows how to use the COUNTIF function to count 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.
Here are a couple of warnings, before you use the COUNTIF function.
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 the Pen orders only.
For a named table, the completed formula shows the table and column names:
and for a worksheet list, the formula shows the cell reference:
Instead of counting exact matches in a complete cell, you might want to count cells where specific text is anywhere in the cell - matching the entire cell value, or any part of it.
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".
For a named table, the completed formula shows the table and column names:
and for a worksheet list, the formula shows the cell reference:
To make your formulas more flexible, and easier to maintain, you can type the text that you want to count in a worksheet cell. Then, in the formula, refer to the cell where you typed the text.
For example, here is the formula to match a specific item, with a reference to cell E7, where pen was typed.
You can use a cell reference with wildcard characters too. Use the & (ampersand) operator to join the wildcard characters to the cell reference.
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.
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.
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.
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.
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.
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.
To see all the COUNTIF examples, download the Count Specific Items sample workbook now. The zipped file is in xlsx format, and does not contain any macros.
Count Criteria in Other Column
Count Cells With Specific Text
Last updated: December 3, 2020 4:46 PM
Contextures RSS Feed