Function Problems

Find the Largest Values by Criteria in Excel with LARGE and IF

Rana GarciaRana Garcia Dec 2, 2026 868 views

Question details

Find the first through fifth largest values in a dataset that match an asset class or another criterion.

Find the Largest Values by Criteria in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet has asset classes in column C and values in column D, and the user wants to rank values for a selected class.
Observed behavior
The desired result is a ranked list of values matching the criterion in H4, with ranks supplied in column F.
Before you start

Check that C2:C25 contains the criteria, D2:D25 contains numeric values, H4 contains the desired class, and F5:F9 contains the ranks 1 through 5. Adjust the ranges if your data is elsewhere, keeping the criteria and value ranges the same size.

Solution 1Recommended

Use LARGE with FILTER in Excel 365 or Excel 2021

Use this formula to rank only the values that match the selected criterion.

1
Enter the criterion and ranks

Type the asset class in H4 and enter 1 through 5 in F5:F9.

2
Enter the formula

Select a result cell such as G5, enter =LARGE(FILTER($D$2:$D$25,$C$2:$C$25=H$4),$F5), and press Enter.

3
Fill down

Drag the fill handle from G5 through G9 to calculate each rank listed in column F.

Use LARGE with FILTER in Excel 365 or Excel 2021
Check the number of matches: LARGE returns an error if the requested rank exceeds the number of matching numeric values. FILTER also returns an error if no rows match.
WPS Spreadsheets

Rank Matching Values in WPS Spreadsheets

Use a LARGE and IF array formula in WPS Spreadsheets to find the largest values for a selected asset class.

  1. 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
  2. 2. Enter the inputs: Put the criterion in H4 and the ranks 1 through 5 in F5:F9. Ensure the criteria are in C2:C25 and numeric values are in D2:D25.
  3. 3. Calculate the first rank: Select G5, enter =LARGE(IF($C$2:$C$25=H$4,$D$2:$D$25),$F5), and confirm the array formula with Ctrl+Shift+Enter.
  4. 4. Fill the remaining ranks: Drag the fill handle from G5 through G9 to calculate the results for the remaining ranks.
Rank values that match a chosen criterionOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interfaceWork with formulas in a free office suite
microsoft office alternative - wps office

Frequently Asked Questions

How do I find the second-largest value for one asset class?

Enter the class in H4 and 2 in F5, then use =LARGE(FILTER($D$2:$D$25,$C$2:$C$25=H$4),$F5) in Excel 365 or Excel 2021.

Why does LARGE return a #NUM! error?

The requested rank may be greater than the number of matching numeric values. Check the rank in F5 and the matching values in D2:D25.

Do duplicate values occupy separate ranks?

Yes. LARGE ranks duplicate values separately, so the first- and second-largest results can be the same.

When do I need to press Ctrl+Shift+Enter?

In older Excel versions, use Ctrl+Shift+Enter to confirm the LARGE and IF array formula. Excel 365 and Excel 2021 can generally confirm it with Enter.