A running count numbers each occurrence of a value as it appears — 1st, 2nd, 3rd time this customer shows up. The trick is the same expanding range as a running total, but with COUNTIF.
$A$2 with the relative end A2 counts how many times the current value has appeared so far.
The example
Number each customer’s visits in order.
| A | B | |
|---|---|---|
| 1 | Customer | Visit # |
| 2 | Acme | 1 |
| 3 | Bolt | 1 |
| 4 | Acme | 2 |
| 5 | Acme | 3 |
The formula
The running count in B2, filled down:
How it works
The expanding range counts occurrences up to the current row:
- The range starts anchored at
$A$2and ends at the relativeA2, so it grows one row taller as you copy down. - In each row,
COUNTIFcounts how many times the current value appears from the top down to here. - The first Acme is 1, the second is 2, the third is 3 — a per-value occurrence number.
- It’s the building block for “flag only repeats,” deduping, and pulling the nth match.
Mark the first occurrence only: =IF(COUNTIF($A$2:A2, A2)=1, "First", "") — the running count equals 1 exactly once per value.
Try it: interactive demo
Type a list; each item is numbered by how many times it has appeared.
Variations
Flag the first occurrence
Running count of 1 = first time seen:
Running count within a group
Number visits per customer per month with COUNTIFS:
Make a unique helper key
Combine value and count for a unique ID:
Pitfalls & errors
Same number on every row. The start of the range isn’t anchored. It must be $A$2:A2 — locked start, relative end.
Grand count vs running count. Locking both ends ($A$2:$A$5) gives the total occurrences on every row, not a running one.
Case-insensitive. COUNTIF treats “acme” and “Acme” as the same. Use a case-sensitive approach if that matters.
Practice workbook
Frequently asked questions
How do I create a running count in Excel?
How do I number occurrences within a group?
How do I flag the first occurrence of each value?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class