Find the Largest Values by Criteria in Excel with LARGE and IF
Question details
Find the first through fifth largest values in a dataset that match an asset class or another criterion.

- 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.
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.
Use LARGE with FILTER in Excel 365 or Excel 2021
Use this formula to rank only the values that match the selected criterion.
Type the asset class in H4 and enter 1 through 5 in F5:F9.
Select a result cell such as G5, enter =LARGE(FILTER($D$2:$D$25,$C$2:$C$25=H$4),$F5), and press Enter.
Drag the fill handle from G5 through G9 to calculate each rank listed in column F.

Use LARGE with IF in older Excel versions
Use an array formula when FILTER is unavailable.
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. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
- 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. 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. Fill the remaining ranks: Drag the fill handle from G5 through G9 to calculate the results for the remaining ranks.

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.




