How to Fix Excel INDEX and MODE Formula Errors with Blank Cells
Question details
The user needs to find the most frequent value in a dataset containing blank cells without triggering an #N/A error, aiming to ignore the blanks and evaluate only valid text entries.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Calculating the statistical mode of text values in a specific cell range using a combination of INDEX, MATCH, and MODE functions.
- Observed behavior
- The formula returns an #N/A error because the MATCH function cannot process the blank cells, which in turn causes the MODE function to fail.
Verify that your blank cells are truly empty and do not contain hidden spaces or invisible characters, as these are treated as text and will skew the MATCH function's evaluation.
Use IFERROR in an Array Formula to Ignore Blanks
Wrap the MATCH function with IFERROR to replace invalid evaluations on blank cells with empty strings, allowing the MODE function to calculate correctly.
The standard MATCH function returns an #N/A error when it evaluates a blank cell. Because MODE cannot process arrays that contain errors, the entire formula fails. By wrapping MATCH in IFERROR, these errors are converted to empty strings, allowing MODE to evaluate the rest of the array seamlessly.
Click on the cell where you want the most frequent value to be displayed.
Type the formula: =INDEX(K5:AF5,MODE(IFERROR(MATCH(K5:AF5,K5:AF5,0),""))). Be sure to replace K5:AF5 with the actual reference of your data range.
If you are using an older version of Excel (prior to Microsoft 365 or Office 2021), press Ctrl + Shift + Enter to apply the formula. This wraps the formula in curly braces {}, allowing it to evaluate the entire range as an array.

Easily Manage Complex Array Formulas with WPS Spreadsheet
WPS Spreadsheet fully supports advanced array functions including INDEX, MATCH, and MODE. You can efficiently analyze text and bypass blank cell errors using the exact same formulas as Excel.
- 1. Open your dataset: Launch WPS Spreadsheet and open your workbook containing the data range with blank cells.
- 2. Input the array formula: Select the cell for your result and paste the formula: =INDEX(K5:AF5,MODE(IFERROR(MATCH(K5:AF5,K5:AF5,0),""))).
- 3. Calculate the result: Press Ctrl + Shift + Enter to apply the array formula. WPS Spreadsheet will instantly calculate the most frequent text value while ignoring all blanks.

Frequently Asked Questions
Why does the standard MODE function return an error for text?
The MODE function is specifically designed to evaluate numeric data. To find the most frequent text value, you must use MATCH to convert the text strings into numerical index positions, which MODE can then evaluate, and finally use INDEX to return the corresponding text string.
How can I filter the range so the formula only evaluates text values?
You can add an IF and ISTEXT condition inside your array formula. Use a structure like =INDEX(range, MODE(IF(ISTEXT(range), MATCH(range, range, 0)))) and press Ctrl+Shift+Enter. This forces the formula to completely ignore numbers and blanks.
What happens if there is a tie for the most frequent value?
The standard MODE function will return the first most frequently occurring value it encounters in the dataset. To display multiple modes in case of a tie, you would need to use the MODE.MULT function combined with a dynamic array spill range.




