How to Create an Excel Formula for Sequential Sales by Employee and Date
Question details
The user needs a formula to generate a sequential numbering of sales grouped by both employee and date.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Generating a sequence number for repeated sales logged by the same employee on the same date.
- Observed behavior
- The user wants a formula that returns 1 for the first matching sale, 2 for the second, and so on, incrementing continuously as rows match the specific employee and date.
Ensure your dataset is organized in contiguous columns with clearly defined headers, such as 'Employee' in column A and 'Date' in column B, with your data starting in row 2.
Use the COUNTIFS Function with Expanding Ranges
Applying a running COUNTIFS formula allows you to count occurrences cumulatively as you drag the formula down a column.
This solution utilizes a combination of absolute and relative cell references to create an expanding range. As the formula is copied down your sheet, the criteria range grows row by row, keeping a precise running tally of grouped matches.
Click on the cell in the row where your data begins, such as cell C2, right next to your employee and date columns.
Type the formula =COUNTIFS($A$2:A2, A2, $B$2:B2, B2) into the formula bar. Make sure column A contains your employee names and column B contains the dates.
Press Enter to see the first result. Then, double-click or drag the fill handle at the bottom right corner of the cell to copy the formula down through all the data rows.

Troubleshoot Incorrect Sequence Results
If the formula does not generate the expected sequence, verify the column references and data formatting.
Easily Manage Complex Formulas with WPS Spreadsheet
WPS Spreadsheet makes it incredibly simple to handle advanced functions like COUNTIFS for sequential numbering, offering a seamless and user-friendly experience for your data analysis workflows.
- 1. Open your dataset: Launch WPS Spreadsheet and open the file containing your sales data.
- 2. Select a blank column: Click on an empty cell in a new column adjacent to your employee and date data.
- 3. Input and execute the formula: Enter the =COUNTIFS formula with your specific ranges and drag the fill handle down to populate the sequence.

Frequently Asked Questions
Why is the COUNTIFS formula returning 0 or #VALUE errors?
This usually happens if the data ranges do not match in size or if there are typos in the formula syntax. Ensure your criteria ranges (e.g., $A$2:A2) perfectly match the size and structure of the criteria arguments being evaluated.
Can I use this formula for three or more criteria?
Yes, the COUNTIFS function can handle multiple criteria simultaneously. Simply append the next expanding range and criteria, such as ,$C$2:C2, C2, into your existing formula.
Do I need to sort my data before applying the COUNTIFS sequential formula?
No, sorting is not strictly required. The running COUNTIFS formula will accurately count the chronological appearance of the matching data as it reads down the spreadsheet rows, regardless of how the rows are currently sorted.




