Function Problems

Assign Sequence Numbers by Employee and Date in Excel

Phi Hung VoPhi Hung Vo Nov 12, 2026 870 views

Question details

Create a sequence number for each employee’s records based on date, with the newest record numbered 1.

Assign Sequence Numbers by Employee and Date in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
Employee IDs are stored in column A and record dates are stored in column C. The user needs a per-employee ranking or sequence in another column.
Observed behavior
The desired result is for newer dates within the same employee ID to receive lower sequence numbers, while older dates receive progressively larger numbers.
Before you start

Make sure the date column contains real Excel dates rather than text values. Decide how tied dates should be handled, because identical dates receive the same result with the basic formula.

Solution 1Recommended

Use COUNTIFS to rank each employee's records by newest date

Use this formula when employee IDs are in column A, dates are in column C, and you want the newest date for each employee to be sequence number 1.

COUNTIFS counts records for the same employee whose dates are greater than or equal to the current row's date. That count becomes the descending date sequence number.

1
Add a sequence number column

Select the first result cell, such as D2, and enter a header such as Sequence Number in D1.

2
Enter the COUNTIFS formula

In D2, enter =COUNTIFS($A$2:$A$1000,$A2,$C$2:$C$1000,">="&$C2). Update 1000 to match or exceed the last row of your data.

3
Fill the formula down

Press Enter, then drag the fill handle from D2 down the column or double-click the fill handle to copy the formula to the remaining records.

4
Check the ranking results

Filter or sort by an employee ID in column A and confirm that the most recent date in column C has sequence number 1.

Use COUNTIFS to rank each employee's records by newest date
Duplicate dates: If the same employee has multiple identical dates, this formula gives those rows the same sequence number. Add a unique record ID as a tie-breaker if every row needs a distinct number.
Work with employee date sequences in WPS Spreadsheet

Rank employee records by date with COUNTIFS in WPS Spreadsheet

WPS Spreadsheet supports COUNTIFS formulas for assigning a descending sequence to each employee’s dated records. Enter the formula once, fill it down, and review the newest-to-oldest numbering directly in your worksheet.

  1. 1. Open the employee worksheet: Open your .xlsx or .xls file in WPS Spreadsheet and identify the employee ID, date, and output columns.
  2. 2. Enter the ranking formula: Click the first output cell, such as D2, and enter =COUNTIFS($A$2:$A$1000,$A2,$C$2:$C$1000,">="&$C2).
  3. 3. Fill the formula down: Press Enter and drag or double-click the cell fill handle to apply the formula to each employee record.
  4. 4. Review results by employee: Use Data > Filter or sort the employee ID and date columns to confirm that the latest date is numbered 1 for each employee.
Use COUNTIFS to assign the newest employee record sequence number 1Fill formulas quickly across large employee record listsOpen and edit Microsoft Excel .xlsx and .xls files with compatible formulasUse a familiar spreadsheet interface for sorting, filtering, and checking results
microsoft office alternative - wps office

Frequently Asked Questions

Why does the newest date receive sequence number 1?

The formula counts rows for the same employee with dates greater than or equal to the current date. A newest date has only itself at or above that date, so the count is 1.

Can I use this formula when my employee IDs and dates are in different columns?

Yes. Replace the A ranges with your employee ID column and replace the C ranges with your date column. Keep the ranges the same size and lock them with $ signs.

What happens when two records for one employee have the same date?

The basic COUNTIFS formula gives both records the same number because both dates meet the same condition. Add a unique record ID column and use it as a tie-breaker when every row needs a distinct sequence.

How do I extend the formula beyond row 1000?

Change every 1000 reference in the formula to a row number that covers your data, such as $A$2:$A$5000 and $C$2:$C$5000. You can also use an Excel Table so formulas expand with new rows.

Does this formula require the data to be sorted by date first?

No. COUNTIFS evaluates the employee ID and date values in the ranges, so the ranking works even if the source records are not sorted. Sorting can still make the results easier to review.