Fix a #NUM! Error in Excel INDEX and LARGE Formulas
Question details
Find out why a formula using INDEX and LARGE returns #NUM! while sorting lookup results.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet ranks lookup results in K5:K38 using the LARGE function.
- Observed behavior
- LARGE returns #NUM! when the requested rank exceeds the number of numeric values in the range.
Check the range and rank used in your LARGE formula. In an empty cell, enter =COUNT(K5:K38) to see how many numeric values are available.
Limit the LARGE rank to available numeric values
Use this approach when a ranking formula is copied down and may request more values than the range contains.
Enter =COUNT(K5:K38) in an empty cell. LARGE(K5:K38,34) needs at least 34 numeric values.
Select the cell with the LARGE formula and compare its second argument with the COUNT result. The rank must be at least 1 and no greater than the numeric count.
For a standalone ranking list, enter =IF(ROWS($A$1:A1)<=COUNT($K$5:$K$38),LARGE($K$5:$K$38,ROWS($A$1:A1)),"") in the first result cell, then copy it down. It returns a blank when there are no more numeric ranks.

Return numeric zeros for missing lookup results
Use this option when missing lookup results should participate in the numeric ranking as zeros.
Check LARGE Formula Ranks in WPS Spreadsheet
Open your workbook in WPS Spreadsheet, count the available numeric values, and adjust the LARGE rank or lookup fallback to prevent unavailable ranks.
- 1. Open the workbook: In WPS Spreadsheet, choose Open and select your Excel workbook.
- 2. Count numeric results: Enter =COUNT(K5:K38) in an empty cell and compare the result with the rank in your LARGE formula.
- 3. Adjust the formula: Select the formula cell and use a rank no greater than the COUNT result, or add an IF check before calling LARGE.
- 4. Save the workbook: Choose Save As and select an Excel format such as XLSX if you need to share the workbook with Excel users.

Frequently Asked Questions
Why does LARGE(K5:K38,34) return #NUM!?
The range has 34 cells, but LARGE needs 34 numeric values to return the 34th-largest value. Enter =COUNT(K5:K38) to check how many numbers it contains.
Does LARGE count hyphens or blank cells?
No. LARGE ranks numeric values, so a hyphen returned as text or a blank cell does not provide a numeric rank.
Can I hide the error with IFERROR?
Yes. For example, =IFERROR(LARGE(K5:K38,34),"") displays a blank instead of an error. It also hides other errors in the LARGE expression, so check the range and rank first.
Will replacing missing values with zero always give the right sort order?
No. Zero becomes part of the ranking and will appear above negative numbers. Use a blank or limit the requested rank if missing results should not be ranked.




