Sub topic 12
Handle no matches and blocked output ranges
Assume you already know cell references, ranges, and basic formulas such as SUM. This chapter focuses on two problems that commonly occur with FILTER, SORT, and other formulas that return multiple cells:
- No rows meet the filter conditions.
- The result cannot expand because other content occupies its output area.
Show a useful message when no rows match
FILTER returns all rows that meet its conditions. If no row meets the conditions, Google Sheets returns #N/A. This is technically accurate, but a report is easier to understand when it displays a message such as No matches.
Wrap the formula in IFERROR. IFERROR returns its first argument when it works and a replacement value when that argument produces an error.
=IFERROR(FILTER(A2:D, C2:C>=1000), "No matches")This formula returns rows whose amount in column C is at least 1000. If no amount meets that condition, it displays No matches.
You can combine FILTER and SORT inside IFERROR:
=IFERROR(SORT(FILTER(A2:D, C2:C>=1000), 3, FALSE), "No matches")The inner FILTER narrows the data. SORT orders the matching rows by the third column in descending order. IFERROR handles an empty result.
Use IFNA instead when you want to handle only the #N/A error produced by no matches:
=IFNA(FILTER(A2:D, C2:C>=1000), "No matches")IFERROR also hides other errors, such as an invalid range or a calculation problem. IFNA is safer when other errors should remain visible during troubleshooting.
Make room for a spilling result
A formula that returns multiple rows or columns creates an array result. The result starts in the formula cell and spills into neighboring cells.
For example, this formula may need several rows and four columns:
=FILTER(A2:D, A2:A="West")If any destination cell contains text, a number, another formula, or certain other objects, Sheets cannot expand the result. It displays a #REF! error with a message that the array result was not expanded because it would overwrite data.
To fix the error:
- Select the formula cell and inspect the expected output area.
- Remove values or formulas that occupy the cells the result needs.
- Check for content far below the visible data, not only near the formula.
- Move the formula to a separate, empty sheet or report area if the source layout must remain unchanged.
- Recheck the result after adding new source rows, because the spill area may grow later.
Do not place notes, totals, or manual labels inside a spill area. Put them above, beside, or below a planned output range. A formula may work today and become blocked when a new matching row appears tomorrow.
Check formulas before hiding errors
If a formula unexpectedly shows No matches, test the filter without the error wrapper:
=FILTER(A2:D, C2:C>=1000)This helps distinguish a genuine empty result from a mistake in the condition. Also confirm that numeric amounts are numbers rather than text and that the source and condition ranges cover the same rows.
Exercise
A sorted filtered report shows #REF! because a note is directly below the formula. What should you do?
Show answer
Move or remove the note so the entire spill area is empty, or move the formula to a separate output area. Do not place manual content inside the result range.