Do running count of occurrence in a list

To get a running count of the specific value that appear in a list of cells. For example, on first occurrence of “T-Shirt”, we will tag it as 1, on second as 2, on third occurrence 3 and so on. For doing this type of counting in Excel, the normal COUNTIF function can do you a favor.
Do running count of an occurrence in list
Supposing, you have a list of data as below screenshot shown, to get the running count of a certain value - “T-Shirt” that appears in the list, you can use a formula based on the IF and COUNTIF functions.
1. Please enter the below formula into a blank cell next to your data:
Note: In the above formula, A2 is the first cell in the data list you want to count from, and the text “T-Shirt” is the specific value of which you want to get running count in occurrence. You should change them to your own values.
2. And then, drag the fill handle down to the cells for applying this formula, and you will get the running count of the specific value, see screenshot:
Explanation of the formula:
=IF(A2="T-Shirt",COUNTIF($A$2:A2,"T-Shirt"),"")
- COUNTIF($A$2:A2,"T-Shirt"): In this COUNTIF function, the $A$2:A2 is a mixed reference (absolute and relative addresses), it create an expanding range that when copying the formula, the first cell in the reference is locked, but the second reference expands to include each new row.
So the COUNTIF function will count the number of cells in the list that are equal to “T-Shirt”, and the result is a running count. - IF(A2="T-Shirt",COUNTIF($A$2:A2,"T-Shirt"),""):This IF function is used to control what result to be displayed: When the value is equal to “T-Shirt”, the result will be displayed; If not, an empty string is returned.
Do running count of every value in list
If you want to get the running count of each item in the data list, you just only need to use the COUNTIF function to accomplish it.
1. Please apply the below formula into a blank cell beside your original data:
2. Then, copy or drag the fill handle down to other cells to get the running count of occurrence of each item, see screenshot:
Relative function used:
- COUNTIF:
- The COUNTIF function is a statistical function in Excel which is used to count the number of cells that meet a criterion.
- IF:
- This IF function tests for a specific condition, returns the corresponding value that you supply for TRUE or FALSE.
More articles:
- Count Unique Numeric Values Based On Criteria
- In Excel worksheet, you may suffer from a problem that count the number of unique numeric values based on a specific condition. For example, how can I count the unique Qty values of the product “T-shirt” from the report as below screenshot shown? In this article, I will show some formulas to achieve this task in Excel.
- Countifs With OR Logic For Multiple Criteria
- Normally, you can use the COUNTIFS function to count cells based on one or more conditions with AND logic in Excel. Have you ever suffered a situation where you need to count more than one value from a single column or a range of cells? This means to count with multiple conditions and OR logic. In this case, you can apply the SUM and COUNTIFS functions together, or use the SUMPRODUCT function.
- Calculate Percentage Breakdown Of Items In A List
- For example, I have a statistics report which lists the option answer of each student, and now, I want a percentage breakdown of each option. It means that I need to know the percentages that the options A, B and C account for all options. In Excel, the COUNTIF and COUNTA functions can be combined to calculate the percentage of a specific value in a list of data.
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
