How to Nth Smallest Value With Criteria in Excel

Learn multiple Excel methods to nth smallest value with criteria with step-by-step examples and practical applications.

excelformulaspreadsheettutorial
12 min read • Last updated: 7/2/2025

How to Nth Smallest Value With Criteria in Excel

Why This Task Matters in Excel

Imagine you manage a product catalog containing thousands of items with prices that vary by region, supplier, and season. Management wants to know not just the cheapest product that meets a set of conditions, but the second-cheapest, third-cheapest, or even tenth-cheapest. In procurement, this allows buyers to negotiate better deals when the absolute lowest price is out of stock. In finance, analysts often look for the fifth-smallest expense over multiple cost centers to spot outliers while ignoring one-off anomalies. Human-resources teams compare the second-lowest salary within a job band to ensure equitable pay. Data scientists rank the seventh-fastest response time that meets a service-level agreement.

In all of these use-cases, you must find the “nth smallest value” while honoring specific criteria such as product category, cost center, employee department, or date range. Excel excels at this type of analysis because it offers array functions that dynamically filter data, rank items, and return results without needing complicated database queries. Mastering this skill means you can answer ad-hoc business questions swiftly, create self-updating dashboards, and support data-driven decisions.

Failing to learn this technique has consequences. Manually sorting and eyeballing values is error-prone, slow, and cannot scale beyond a few dozen rows. Attempting to approximate the answer with pivot tables or basic filters often breaks as soon as new data arrives. Not knowing the proper approach also prevents you from building more advanced models, such as dynamic pricing sheets, robust tiered commission calculators, or automated escalation trackers. Learning how to retrieve the nth smallest value with criteria therefore plugs directly into broader Excel competencies—logical tests, dynamic arrays, and advanced referencing—that increase your analytical power across every industry.

Best Excel Approach

For modern versions of Excel (Microsoft 365, Excel 2021, and Excel for the web) the most versatile technique is to combine FILTER with SMALL (or MINIFS for the first smallest) and wrap the logic inside the INDEX function. FILTER creates a spill range that contains only the values meeting your criteria, SMALL extracts the nth numeric value from that filtered list, and INDEX returns it in a single cell—all without helper columns.

Core syntax:

=INDEX( SMALL( FILTER( values_range, criteria_range1=criterion1  *  criteria_range2=criterion2 ), n ), 1 )

Key points

  • FILTER dynamically picks rows where every criterion evaluates to TRUE, producing an array of candidates.
  • The multiplication symbol between logical tests behaves like AND; use plus signs (+) for OR logic.
  • SMALL(array, n) returns the nth smallest element in the filtered array.
  • INDEX(value,1) converts the result from a spill array into a single scalar value so it plays well with legacy functions or further calculations.

When to use: Any time you have modern Excel and the dataset is not extremely large (less than 100k rows). It is readable, fully dynamic, and naturally extends to multiple criteria.

Alternative legacy approach: Use AGGREGATE or SMALL nested inside an IF delivered as an array formula (Ctrl+Shift+Enter in pre-365 Excel). Suitable when you or your audience are on Excel 2016 or earlier.

=SMALL( IF( (criteria_range1=criterion1)*(criteria_range2=criterion2), values_range ), n )

However, these older formulas can be harder to maintain and slower on big datasets.

Parameters and Inputs

  1. values_range – The numeric column from which you want to pick the nth smallest value. Must contain numbers; blanks and text are ignored by SMALL automatically.
  2. criteria_range(s) – One or more ranges the same size (row count) as values_range. These hold the attributes you are filtering by, such as Region, Category, or Date.
  3. criterion(s) – The actual condition(s) to match, e.g. \"West\", \"Widgets\", or a date greater than 2023-01-31. Use cell references whenever possible to keep the formula flexible.
  4. n – The rank you need: 1 for smallest, 2 for second smallest, etc. Must be an integer greater than zero. Feeding a value larger than the number of matches returns the #NUM! error.
    Optional considerations
  • Use LET to store intermediate arrays for readability and speed.
  • If criteria may include blanks, decide whether blanks are valid matches.
  • If you require case-sensitive text matching, wrap criteria_range in EXACT.
  • For date comparisons, ensure both columns are proper date serials rather than text.
  • When your data contains error values (for example #DIV/0!), consider wrapping FILTER in IFERROR to avoid error propagation.

Step-by-Step Examples

Example 1: Basic Scenario

Suppose you have a list of products in [A2:A15], their categories in [B2:B15], and prices in [C2:C15]. You want the third-cheapest price for items in the \"Hardware\" category.

Sample data
Product | Category | Price
Hammer | Hardware | 19.99
Drill | Hardware | 45.00
Screwdriver | Hardware | 5.50
Saw | Hardware | 24.99
Paint | Supplies | 18.75

Steps

  1. Enter \"Hardware\" in cell [E2].
  2. Enter the desired rank (3) in cell [E3].
  3. In cell [E4] type:
=INDEX( SMALL( FILTER( C2:C15, B2:B15=E2 ), E3 ), 1 )

Press Enter. Because FILTER returns [19.99,45.00,5.50,24.99], SMALL with n=3 returns 24.99, and INDEX outputs 24.99 into [E4].

Why it works: FILTER restricts the price list to rows where the category equals the value in [E2]. SMALL ranks that subset. INDEX strips the one-item array down to a single value so it does not spill.

Variations

  • Change [E3] to 1 for the cheapest, 2 for second cheapest, etc.
  • Link [E2] to a dropdown via Data Validation so users can select a category.
  • Troubleshooting: If [E4] shows #NUM!, the rank exceeds available matches. Adjust [E3] or provide a custom message with IFERROR.

Example 2: Real-World Application

Scenario: A telecom company tracks average call handling time (AHT) for agents across multiple call centers. Data columns are Agent in [A2:A5000], Center in [B2:B5000], Month in [C2:C5000], and AHT in seconds in [D2:D5000]. Management wants the second-lowest AHT for the Chicago center in March 2023 to award a “runner-up” bonus.

Data prep: Each row represents one agent per month; there are 5,000 records.

Formula

  1. In [H2] type \"Chicago\", in [H3] type DATE(2023,3,1), in [H4] type 2.
  2. Put this formula in [H5]:
=LET(
     center, H2,
     month, H3,
     rank, H4,
     filtered, FILTER( D2:D5000, (B2:B5000=center)*(C2:C5000=month) ),
     INDEX( SMALL( filtered, rank ), 1 )
)

Explanation

  • LET assigns center, month, rank, and filtered arrays to variables, improving performance because each range is calculated once.
  • FILTER narrows AHT values to Chicago calls in March 2023.
  • SMALL returns the second-lowest value as requested.
  • INDEX converts the single-item array to a scalar.

Business benefit
This formula supports a dashboard where management can change the month cell [H3] via a slicer linked to a pivot table, instantly showing updated runner-up times. The approach scales because FILTER and SMALL are vectorized; Excel finished recalculating 5,000 rows almost instantly on modern hardware.

Integration

  • Use Conditional Formatting to highlight agents whose AHT equals the returned second-lowest value.
  • Combine with XLOOKUP to retrieve the agent’s name:
=XLOOKUP( H5, D2:D5000, A2:A5000, "No Match", 0 )

Performance tips
For datasets above 50,000 rows, convert the table to an official Excel Table (Ctrl+T) and turn off “Automatic data range” recalc in large workbooks. FILTER remains fast because it is executed within the Excel calculation engine rather than VBA.

Example 3: Advanced Technique

Objective: In a project dashboard you must find the fourth-smallest project cost that meets two conditions: the project is not cancelled, and the start date is within the last 90 days from today. Additionally, you need an error-proof solution that defaults to “N/A” if fewer than four qualifying projects exist.

Data layout:

  • Status in [B2:B20000] with possible values \"Active\", \"On Hold\", \"Cancelled\".
  • StartDate in [C2:C20000] as real dates.
  • Cost in [D2:D20000] (numeric).

Solution formula in [H2]:

=LET(
     today, TODAY(),
     cutoff, today-90,
     qualified, FILTER(
                      D2:D20000,
                      (B2:B20000<>"Cancelled")*(C2:C20000>=cutoff)
               ),
     nth, 4,
     IFERROR( INDEX( SMALL( qualified, nth ), 1 ), "N/A" )
)

Advanced aspects

  • Dynamic cutoff date ensures the rolling 90-day window updates automatically.
  • The non-equality operator <> filters out cancelled projects.
  • IFERROR captures two likely failures: the FILTER could return an empty array, or SMALL could produce #NUM! if fewer than four matches exist.
  • Because everything is inside LET, you can reuse the cutoff date elsewhere in the workbook by adding another variable.

Professional tips

  • Wrap the formula in ROUND or TEXT if you must present costs with currency formatting.
  • Store nth in a separate cell so stakeholders can change the rank without editing the formula.
  • For datasets larger than 100k rows saved on SharePoint, consider moving to Power Query for pre-filtering, then use these formulas on the reduced output to maintain snappy dashboards.

Tips and Best Practices

  1. Always reference whole columns in FILTER only when truly needed; otherwise limit the row count to improve calculation speed.
  2. Use named ranges or Table column syntax (e.g., Table1[Price]) instead of [A2:A1000] so the formula auto-expands as data grows.
  3. Store n in a cell and protect it with Data Validation allowing only positive integers. This prevents accidental #NUM! errors.
  4. Combine the result with XLOOKUP or INDEX-MATCH to return associated information (e.g., the corresponding product or agent).
  5. Nest the entire formula inside IFERROR early in development. It keeps worksheets clean while you experiment.
  6. Document logic with comments or LET variable names; future you (or coworkers) will thank you when revisiting the workbook.

Common Mistakes to Avoid

  1. Mismatched range sizes: FILTER will return #VALUE! if values_range and criteria_range lengths differ. Always double-check row counts.
  2. Forgetting to convert the spill array: If you skip INDEX, the result may spill vertically and break adjacent cells. Wrap the SMALL output in INDEX when you need a single cell.
  3. Using n larger than total matches: Users often hard-code n=10 without verifying there are ten qualifying rows, resulting in #NUM!. Provide an IFERROR or validate the count with COUNTA.
  4. Mixing text and numbers in values_range: SMALL ignores text, so if your numeric column contains \"N/A\" strings, filter them out or convert to proper blanks.
  5. Confusing AND and OR logic: Remember multiplication acts as AND, addition as OR. Misusing these operators can silently return zero rows, making troubleshooting harder.

Alternative Methods

Some organizations still rely on legacy Excel versions. Below is a comparison of popular techniques:

MethodExcel VersionProsCons
FILTER + SMALL + INDEX (dynamic array)365 / 2021Readable, spills automatically, no Ctrl+Shift+EnterNot available in 2016 or earlier
SMALL with IF (array-enter)2007-2019Works in older versionsRequires Ctrl+Shift+Enter, harder to audit
AGGREGATE with conditional logic2010+Ignores errors without IFERROR, no array entry for SMALLLess intuitive syntax, slower than FILTER
PivotTable with Top N filterAllPoint-and-click, no formulasStatic snapshot; needs refresh, limited to first smallest only
Power Query, then MIN, sort2010+ (with add-in)Handles millions of rows, lightweight workbook formulasRequires refresh, not real-time in sheet

When to use each

  • Dynamic arrays are ideal when everyone uses Microsoft 365.
  • Array formulas with IF remain the fallback for legacy environments.
  • AGGREGATE is a good option when you want to ignore error values without wrapping IFERROR around everything.
  • Power Query shines for huge datasets or when you need an ETL step (extract, transform, load) before analysis.

FAQ

When should I use this approach?

Use it any time you need to return ranked results (first, second, third...) while enforcing one or more filters. Typical cases include price comparisons, SLA compliance reports, or auditing second-lowest bids in procurement.

Can this work across multiple sheets?

Yes. Simply qualify your ranges with sheet names such as Sheet1!A2:A1000. When the criteria and values are on different worksheets, ensure all ranges remain the same size. For many sheets, consolidate data into a single Table or use Power Query to avoid overly complex 3D references.

What are the limitations?

FILTER is unavailable in Excel 2016 and prior; array formulas require Ctrl+Shift+Enter in those versions. If your filtered list contains fewer rows than n, you will receive #NUM!. Also, SMALL only works with numeric data; text values are ignored. For text ranking, use SORT instead.

How do I handle errors?

Wrap the final result in IFERROR to display a custom message. For example:

=IFERROR( INDEX( SMALL( FILTER(...) , n) , 1 ), "No match" )

Alternatively, use COUNTIFS to calculate how many rows meet the criteria first and compare that count to n before running SMALL.

Does this work in older Excel versions?

Yes, but you must replace FILTER with IF wrapped in Ctrl+Shift+Enter and may need AGGREGATE. Example for Excel 2013:

=SMALL( IF( (B2:B15="Hardware")*(C2:C15>=DATE(2023,1,1)), C2:C15 ), n )

After typing, press Ctrl+Shift+Enter so that Excel surrounds the formula with braces.

What about performance with large datasets?

Dynamic arrays recalculate fast for typical business datasets under 100k rows. For larger data, load the sheet as an Excel Table, limit formulas to the exact row count, or move heavy filtering to Power Query. Turning on “Manual calculation” and adding a Calculate button lets users decide when to refresh.

Conclusion

Retrieving the nth smallest value with criteria combines three of Excel’s strongest capabilities: dynamic filtering, ranking, and array handling. Once you master this pattern you can build smarter dashboards, automate tedious ranking tasks, and extend the logic to nth largest, median with criteria, or even percentile analysis. Practise with the examples above, adapt them to your data, and explore alternative methods such as AGGREGATE or Power Query for broader compatibility. Developing this single skill opens the door to faster, more reliable, and more insightful analysis across nearly every business function—so start integrating it into your workflow today.

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.