Extracting Top N Values in Excel With Multiple Criteria: Formula Guide

📅 Jun 25, 2026 📝 Sarah Miller

Isolating top-performing data points under specific criteria in Excel often leads to tedious, error-prone manual filtering. While standard PivotTables or basic LARGE formulas offer static workarounds, they fail to adapt dynamically as your source data evolves. Implementing modern dynamic formulas grants analysts immediate, automated ranking capabilities that update in real time.

Stipulation: This advanced methodology requires Excel 365 or Excel 2021 to leverage dynamic array engines like FILTER and SORT. For instance, extracting the "Top 3 Sales in the East Region" becomes entirely hands-free. Below, we break down the exact formula combination and configuration steps to master this multi-conditional extraction.

Extracting Top N Values in Excel With Multiple Criteria: Formula Guide

Data analysis frequently requires us to drill down into our datasets to find top performers. Whether you need to identify the top 5 sales representatives in a specific region, the top 3 highest-performing products in a particular category, or the top 10 students in a specific grade, extracting these data points is a fundamental skill.

Historically, finding the "Top N" values in Excel based on multiple conditions was a complex task requiring nested array formulas, helper columns, or VBA. However, with the introduction of modern dynamic array functions in Excel 365 and Excel 2021, this process has been simplified dramatically. In this comprehensive guide, we will explore both the modern, streamlined approach and the legacy formulas required for older versions of Excel.

The Sample Dataset

To demonstrate these formulas, let's assume we have a sales dataset named SalesTable with the following structure:

Rep Name Region Category Revenue
AliceEastTechnology$15,000
BobWestFurniture$12,000
CharlieEastTechnology$18,500
DavidWestTechnology$14,000
EvaEastFurniture$9,500
FrankEastTechnology$15,000
GraceEastTechnology$11,000
HenryWestTechnology$17,500

Our objective is to extract the Top 3 Revenue records where the Region is "East" and the Category is "Technology".


Method 1: The Modern Approach (Excel 365 & Excel 2021)

If you are using Excel 365 or Excel 2021, you have access to dynamic arrays. We can combine three powerful functions to solve this problem easily: FILTER, SORT, and TAKE.

The Formula

To extract the entire row of data for the top 3 sales, use this formula:

=TAKE(SORT(FILTER(SalesTable, (SalesTable[Region]="East") * (SalesTable[Category]="Technology")), 4, -1), 3)

How It Works Step-by-Step

  1. FILTER(SalesTable, (SalesTable[Region]="East") * (SalesTable[Category]="Technology")): This function filters the entire table. The asterisk (*) acts as an AND operator in array calculations. It checks if the Region is "East" and the Category is "Technology". Only rows matching both criteria are returned.
  2. SORT(..., 4, -1): This takes the filtered results and sorts them. The 4 represents the index of the column we want to sort by (Revenue is the 4th column in our table). The -1 specifies a descending sort order (highest to lowest).
  3. TAKE(..., 3): Finally, the TAKE function extracts the top N rows from the sorted array. By inputting 3, we tell Excel to return only the first three rows of our sorted and filtered dataset.

Because these are dynamic array functions, you only need to type the formula in a single cell. The results will automatically "spill" into the adjacent rows and columns.


Method 2: Extracting Only the Values (Using LARGE with FILTER)

If you do not want to return the entire row but instead only want to extract the top N numerical values (the Revenue figures) based on criteria, you can combine LARGE and FILTER:

=LARGE(FILTER(SalesTable[Revenue], (SalesTable[Region]="East") * (SalesTable[Category]="Technology")), {1;2;3})

In this formula, the array constant {1;2;3} dictates that Excel should return the 1st, 2nd, and 3rd largest values. This will spill vertically down three rows.


Method 3: The Legacy Approach (Excel 2019 and Older)

If you are working with an older version of Excel, you do not have access to FILTER, SORT, or TAKE. You must rely on legacy array formulas (entered using Ctrl + Shift + Enter) to get the job done.

To extract the top N values using older versions, we perform a two-step process: first, extract the top values, and second, extract the names associated with those values.

Step 1: Extracting the Top N Revenue Values

In your target cell for the highest value (let's say cell G2), enter the following array formula and press Ctrl + Shift + Enter:

=LARGE(IF((SalesTable[Region]="East")*(SalesTable[Category]="Technology"), SalesTable[Revenue]), ROWS($1:1))

Drag this formula down to cells G3 and G4 to get the 2nd and 3rd highest values.

How it works: The IF function filters the rows. If the conditions are met, it returns the Revenue; otherwise, it returns FALSE. The LARGE function ignores FALSE values. ROWS($1:1) acts as a dynamic counter that evaluates to 1 in the first row, 2 in the second row (as it becomes ROWS($1:2)), and so on.

Step 2: Extracting the Corresponding Names (Handling Ties)

Retrieving the names associated with those top values is tricky, especially if there are duplicate sales figures (ties). In our sample data, Alice and Frank both have a revenue of $15,000.

A simple VLOOKUP or INDEX/MATCH will fail because it will return the first match (Alice) twice. To solve this, we must use an array formula that accounts for duplicates by looking at row numbers:

=INDEX(SalesTable[Rep Name], SMALL(IF((SalesTable[Region]="East")*(SalesTable[Category]="Technology")*(SalesTable[Revenue]=G2), ROW(SalesTable[Revenue]) - MIN(ROW(SalesTable[Revenue])) + 1), COUNTIF($G$2:G2, G2)))

Remember to press Ctrl + Shift + Enter when entering this formula in older Excel versions.

How it works: This formula identifies all rows matching our criteria and our target revenue value (stored in G2). It returns their relative row indexes. The COUNTIF($G$2:G2, G2) acts as an occurrence counter. If it's the first time we see $15,000, it pulls the first match (Alice). For the second occurrence, the counter increases to 2, pulling the second match (Frank).


Comparison: Modern vs. Legacy Methods

Feature Modern Excel (365/2021) Legacy Excel (2019 & Older)
Complexity Low (Clean, nested logical flow) High (Requires CSE, array math, and index tracking)
Handling Ties Automatic (Returns distinct rows natively) Requires complex helper arrays/occurrence counters
Performance Excellent (Optimized calculation engine) Slow on large datasets due to array processing
Maintenance Easy (Single formula spills automatically) Hard (Must copy formulas across cells manually)

Best Practices and Pro-Tips

  • Use Excel Tables: Always keep your source data structured inside an official Excel Table (created via Ctrl + T). This allows you to use structured references (e.g., SalesTable[Revenue]) which automatically expand when new data is added.
  • Handling Empty Results: If your criteria might return no matches, wrap your formula inside an IFERROR or use the optional [if_empty] argument inside the FILTER function to prevent ugly #CALC! or #N/A errors. E.g., FILTER(..., "No Matches Found").
  • OR Logic: If you need to apply "OR" criteria instead of "AND", use addition (+) instead of multiplication (*). For example, to find top values where the Region is "East" OR "West", write your criteria as (SalesTable[Region]="East") + (SalesTable[Region]="West").

Conclusion

Extracting the top N values with multiple criteria no longer requires cumbersome workarounds if you are using modern Excel. The combination of TAKE, SORT, and FILTER provides a robust, fast, and elegant solution. For legacy environments, utilizing a combination of LARGE, INDEX, and MATCH with a tie-breaking logic ensures that your spreadsheets remain compatible across all user bases.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.