logo
search
Function Problems

How to Create a Running Count by Type in Excel Using COUNTIF

Olivia MillerOlivia Miller Oct 10, 2026 870 views

Question details

The user wants to generate an automatic running count (occurrence number) for repeated values in a specific column using an Excel formula.

How to Create an Automatic Running Count by Type in Excel
Product
Excel
Device & OS
not provided
Scenario
Tracking data, occurrences, or inventory where items of the same type appear multiple times and require a sequential count next to them.
Observed behavior
Requires a dynamic formula that increments the count of a specific type as new data is added down the column, without needing manual updates.
Before you start

Ensure your data is organized in clear columns without merged cells. Identify the specific column where your 'Type' values are located (e.g., Column D) before entering your formula.

Solution 1Recommended

Use the COUNTIF Function with an Expanding Range

The most efficient way to create a running count is by using an expanding range reference inside the COUNTIF function.

By anchoring the first row of your range and leaving the second row relative, the formula range expands as you drag it down. This allows Excel to count how many times a specific value has appeared from the top of the data set up to the current row.

1
Select the target cell

Click on the cell in the first data row of your 'Type #' or 'Count' column (e.g., E2) where you want the running count to appear.

2
Enter the COUNTIF formula

Assuming your type values start in cell D2, type the formula: =COUNTIF(D$2:D2, D2).

3
Fill the formula down

Press Enter to apply the formula. Then, click the fill handle (the small square at the bottom-right corner of the selected cell) and drag it down the column to apply the count to the remaining rows.

Use the COUNTIF Function with an Expanding Range
Understanding Expanding Ranges: The dollar sign in D$2 locks the starting point of the range. The second reference, D2, remains relative. As you drag the formula down to row 3, it automatically changes to =COUNTIF(D$2:D3, D3), effectively expanding the counted area.
Free Spreadsheet Software

Calculate Running Counts Effortlessly in WPS Spreadsheet

WPS Office offers a powerful Spreadsheet application fully compatible with Excel formulas, including COUNTIF and expanding range references. You can organize data, calculate running counts, and analyze information completely for free.

  1. 1. Open your file in WPS: Launch WPS Office and open your spreadsheet file.
  2. 2. Input the formula: Select the cell next to your first item, and type =COUNTIF(D$2:D2, D2).
  3. 3. Drag to fill: Double-click or drag the fill handle at the bottom right corner of the cell to apply the formula down the column.
  4. 4. Review results: WPS Spreadsheet will instantly output the precise running count for each item type.
Fully supports COUNTIF, COUNTIFS, and complex mixed cell references.Seamless format compatibility with Microsoft Excel (.xlsx, .xls) files.Free, lightweight, and fast-loading spreadsheet editor for everyday use.User-friendly interface that feels instantly familiar to Excel users.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my running count formula returning 0 or giving errors?

Ensure that the criteria cell reference matches the exact text or number in your target column without extra leading or trailing spaces. Additionally, check that your formula uses a comma or semicolon correctly, as this depends on your operating system's regional settings.

Can I use COUNTIFS to do a running count based on multiple conditions?

Yes, you can use the COUNTIFS function to add more criteria. For example, =COUNTIFS(D$2:D2, D2, C$2:C2, "Completed") will give a running count of a specific type only if the status in column C is marked as 'Completed'.

How do I restart the running count if the list is sorted differently?

The expanding range COUNTIF formula relies on the physical top-to-bottom order of the rows. If you re-sort the data, the expanding range (e.g., D$2:D20) will automatically recalculate the running occurrence based on the new visual order.

Why does the formula use a dollar sign ($) only for the row number?

The dollar sign ($) creates an absolute reference. Writing D$2 locks row 2 so the counting range always starts from the top. Leaving the second reference as D2 (without dollar signs) creates a relative reference, allowing the bottom of the range to move down as you copy the formula to lower rows.