How to Rank Excel Values Within Date and Session Groups
Question details
The user needs to rank quantities within matching date and session groups in a spreadsheet, as standard ranking formulas like RANK.EQ do not accept dynamically filtered arrays.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Assigning competition ranks to data rows grouped by multiple criteria, such as specific Dates and Sessions.
- Observed behavior
- The RANK.EQ function returns an error or fails when attempting to rank a dynamically filtered array based on multiple grouping conditions.
Ensure your dataset is organized in a clear tabular format with consistent column headers for Date, Session, and Quantity before applying advanced array formulas.
Use the COUNTIFS Function to Rank Within Groups
This is the most straightforward method to rank data conditionally. It safely assigns the same rank to duplicate quantities without relying on dynamic arrays.
By counting how many values in the same group are strictly greater than the current value, and then adding 1, you can accurately mimic standard ranking behavior.
Click on the cell in the first data row where you want the computed rank to appear.
Type the formula =COUNTIFS($A$2:$A$23, A2, $B$2:$B$23, B2, $D$2:$D$23, ">"&D2)+1. In this example, Column A represents the Date, Column B represents the Session, and Column D contains the Quantities to rank.
Press Enter to generate the rank for the first row, then drag the fill handle down to apply this formula to the rest of the column.

Use MATCH with SORT and FILTER for Sequential Ranking
Use this dynamic array formula approach if you are using a modern spreadsheet version and need exact sequential ranking.
Use SUM and FILTER as an Alternative Array Method
This method uses Boolean logic within a SUM function to count how many items in the targeted group have a higher or equal quantity.
Rank Data Within Groups Effortlessly in WPS Spreadsheet
WPS Spreadsheet fully supports advanced functions like COUNTIFS, MATCH, SORT, and FILTER, allowing you to rank complex datasets grouped by dates and sessions without compatibility issues.
- 1. Open your dataset in WPS: Launch WPS Spreadsheet and open your workbook containing the Date, Session, and Quantity columns.
- 2. Input the grouping formula: Select the target cell and enter your preferred ranking formula, such as =COUNTIFS(A:A, A2, B:B, B2, D:D, ">"&D2)+1.
- 3. Fill the column dynamically: Double-click the small square fill handle at the bottom right corner of the cell to instantly copy the formula down your dataset.

Frequently Asked Questions
Why does RANK.EQ return an error when used with the FILTER function?
The RANK.EQ function requires a hard range reference as its second argument. When you pass a dynamically filtered array (like the output of a FILTER function) instead of a physical range, the function cannot process the in-memory array and returns a #VALUE! or #N/A error.
How do I rank grouped data with unique sequential numbers?
To avoid duplicate ranks for tied values in your groups, you can use the MATCH function combined with SORT and FILTER. This evaluates the exact sorted position of a value within the filtered array, forcing a sequential numbering.
What should I do if my MATCH and FILTER formula returns a #CALC! error?
A #CALC! error usually means the FILTER function returned empty results because no data matched your Date and Session criteria. Ensure your criteria references are correct and consider wrapping your FILTER formula in an IFERROR, or use the optional 'if_empty' argument.




