Function Problems

How to Count Each Occurrence of a Name in Excel

Aamir Naveed AkramAamir Naveed Akram Oct 19, 2026 873 views

Question details

The user needs a formula to sequentially number repeated names in a column, returning 1 for the first occurrence, 2 for the second, and so on.

Product
Excel
Device & OS
not provided
Scenario
Tracking and organizing duplicate data entries where identifying the exact sequence number of a repeated item is necessary for analysis.
Observed behavior
A dynamic formula is required to output the cumulative count of a specific string as the list expands downward.
Before you start

Ensure your dataset is organized in a single column and identify the exact starting cell of your list to properly anchor your formula.

Solution 1Recommended

Use the COUNTIF Formula with an Expanding Range

The most effective way to sequentially number duplicate entries is by using the COUNTIF function with a mixed cell reference that expands as you copy it.

The COUNTIF function normally counts all instances of a value in a fixed range. By locking only the starting cell (absolute reference) and leaving the ending cell unlocked (relative reference), the range dynamically grows as you drag the formula down the column.

1
Select the target cell

Click the blank cell immediately adjacent to the first name in your list. For example, if your names begin in cell B2, click on cell C2.

2
Enter the formula

Type the formula =COUNTIF($B$2:B2, B2) into the formula bar and press Enter.

3
Fill the formula down

Select cell C2 again. Click and hold the small square at the bottom-right corner of the cell (the fill handle), and drag it down to apply the formula to the rest of the rows.

Use the COUNTIF Formula with an Expanding Range
Formula Logic: The absolute reference ($B$2) anchors the starting point, while the relative reference (B2) stretches the range row by row. If the names are Alex, Sam, Alex, the formula correctly returns 1, 1, and 2.
Manage Data Effectively

Count Name Occurrences Seamlessly in WPS Spreadsheet

WPS Spreadsheet provides robust support for logical functions like COUNTIF. You can effortlessly track duplicate values using mixed cell references, enjoying a seamless experience tailored for complex data analysis.

  1. 1. Open your file: Launch WPS Spreadsheet and open the document containing your list of names.
  2. 2. Input the formula: In an adjacent blank column, enter =COUNTIF($B$2:B2, B2) starting at the first row of your data.
  3. 3. Auto-fill the column: Hover over the bottom-right corner of the cell until the crosshair appears, then double-click to automatically fill the formula down the entire dataset.
100% compatible with Microsoft Excel formulas and functionsFree, lightweight, and fast to load large datasetsIntuitive drag-and-fill features for rapid data processing
microsoft office alternative - wps office

Frequently Asked Questions

Why does my COUNTIF formula return the total count instead of sequential numbers?

If you see the final total count in every row, you likely locked the entire range (e.g., $B$2:$B$100). To generate sequential counts, ensure only the first cell reference is absolute ($B$2) and the second is relative (B2).

Is the COUNTIF formula case-sensitive when counting names?

No, the COUNTIF function treats uppercase and lowercase letters identically. For instance, 'Alex' and 'alex' will be counted as occurrences of the same name.

How can I count sequential occurrences based on multiple columns?

If you need to count occurrences based on multiple criteria, use the COUNTIFS function instead. You can apply the same expanding range logic, such as =COUNTIFS($B$2:B2, B2, $C$2:C2, C2).