When building complex dashboards in Google Sheets, especially those relying on VLOOKUP or mathematical division, encountering error messages like #N/A, #DIV/0!, or #ERROR! is inevitable. While these errors are technically correct—they inform you that a search term wasn’t found or a calculation is impossible—they look highly unprofessional and can break other downstream formulas.
Instead of leaving ugly red error triangles in your spreadsheet, you can intercept and hide them using the IFERROR function.
In this guide, you will learn how to wrap your existing formulas in IFERROR to replace jarring error messages with blank cells, zeros, or custom text.
The Basic IFERROR Syntax
The IFERROR function acts as a safety net. You place your actual formula inside it. If your formula works perfectly, IFERROR does nothing and displays the correct result. If your formula throws an error, IFERROR catches it and displays a fallback value of your choice.
The syntax requires two arguments:
=IFERROR(value, [value_if_error])
- value: This is your actual formula (e.g.,
A2/B2or aVLOOKUP). - value_if_error: This is what you want to display if the first part breaks.
Use Case 1: Hiding Division by Zero Errors
Imagine you are calculating a profit margin by dividing Profit (Column A) by Revenue (Column B). If a new product has zero revenue so far, the formula =A2/B2 will throw a glaring #DIV/0! error.
To fix this and display a clean, blank cell instead, wrap the division in IFERROR:
=IFERROR(A2/B2, "")
By using two double quotation marks with nothing in between (""), you instruct Google Sheets to leave the cell completely blank if an error occurs. If A2/B2 works successfully, it will display the normal percentage.
Use Case 2: Taming VLOOKUP Errors
VLOOKUP is notorious for throwing #N/A errors. This happens when you ask it to search for an item (e.g., “Employee ID 1045”) that does not exist in the database.
Leaving an #N/A in a cell is dangerous because if you try to SUM a column containing an #N/A, the entire SUM formula will also break and return #N/A.
To safely handle missing data, you can instruct IFERROR to return a custom text string, like “Not Found”:
=IFERROR(VLOOKUP(D2, A1:B100, 2, FALSE), "Not Found")
Alternatively, if you are pulling numeric data (like sales figures) and want the missing data to be treated as zero so your SUM formulas don’t break, use a zero without quotation marks:
=IFERROR(VLOOKUP(D2, A1:B100, 2, FALSE), 0)
Nested IFERROR for Fallback Searches
Advanced users can use IFERROR to perform a “fallback” search. If a VLOOKUP fails to find an item in Table A, you can instruct IFERROR to automatically run a second VLOOKUP on Table B.
=IFERROR(VLOOKUP(D2, TableA, 2, FALSE), VLOOKUP(D2, TableB, 2, FALSE))
In this scenario, if the first VLOOKUP throws an error, the value_if_error triggers the second VLOOKUP instead of text. Only if the second VLOOKUP also fails will the cell finally throw an error.
By wrapping your fragile formulas in IFERROR, you guarantee that your Google Sheets remain clean, professional, and mathematically sound, regardless of missing or incomplete data.