To handle errors in Google Sheets, use the IFERROR function: =IFERROR(value, [value_if_error]). It returns the first argument if it evaluates without error; otherwise, it returns the second argument. This is the quickest way to replace #N/A, #DIV/0!, #VALUE!, and similar errors with a blank, zero, or custom message. You need only a Google account and a spreadsheet; no add-ons or scripts are required.
What You'll Need
- A Google account with access to Google Sheets (free).
- A spreadsheet open in a browser or the Google Sheets mobile app.
- Basic familiarity with entering formulas and cell references.
Step-by-Step
- Open your spreadsheet. Go to sheets.google.com and open the file, or use the Google Sheets app on Android or iOS. The steps below apply to both; menu labels may differ slightly by version, device, or region.
- Select the cell where you want the result. Click or tap the cell. This is where the IFERROR formula will live.
- Start the formula. Type
=IFERROR((or tap the formula bar and type it). Do not add a space after the equals sign. - Enter the value or expression to test. This is usually a formula that might fail, such as
A2/B2for division,VLOOKUP(D2, A2:B10, 2, FALSE)for a lookup, or a reference likeC2. Type it directly or click the cell(s) to insert references. - Add a comma, then the fallback value. After the expression, type a comma and then what should appear if an error occurs. Common choices:
""(empty text),0,"Not found", or another formula. For example:=IFERROR(A2/B2, ""). - Close the parenthesis and press Enter. The formula should look like
=IFERROR(value, value_if_error). Press Enter (or the checkmark on mobile) to commit. - Copy the formula down or across. Drag the fill handle (small square at the bottom-right of the cell) or copy and paste to apply it to other rows. Relative references adjust automatically.
- Verify the result. If the original expression would have errored, you should see your fallback value. If it would have succeeded, you see the normal result. To test, temporarily change a referenced cell to cause an error (e.g., set a denominator to 0) and confirm the fallback appears.
Common Mistakes
- Forgetting the comma. IFERROR requires two arguments separated by a comma. Omitting the second argument causes a formula parse error.
- Using IFERROR to hide all errors blindly. It can mask real problems like broken references or wrong data types. Use it only where an error is expected and acceptable.
- Quotes around numbers. If you want a numeric fallback, use
0without quotes."0"returns text, which can break later calculations. - Nesting IFERROR unnecessarily. One IFERROR around the whole expression is enough; wrapping each part separately is redundant and harder to read.
- Assuming IFERROR catches all errors. It does not catch errors in the fallback argument itself. If the fallback formula errors, that error will show.
Tips
- Use
""as the fallback to keep cells visually clean, especially in dashboards. - Combine with
IFfor conditional logic:=IFERROR(IF(A2>0, B2/A2, ""), ""). - For lookups, IFERROR is often paired with VLOOKUP or XLOOKUP to show a friendly message like "Not found" instead of #N/A.
- If you need to distinguish error types, use
ISERRORorERROR.TYPEinside an IF statement instead of IFERROR. - On mobile, the formula bar is available; tap the cell, then the formula bar to edit. The function name is not case-sensitive.
Troubleshooting
- Formula parse error: Check for missing commas, unmatched parentheses, or stray spaces. Ensure the fallback argument is present.
- IFERROR not working as expected: Confirm the error is actually occurring in the first argument. If the first argument returns a valid value, IFERROR returns it unchanged.
- Fallback shows an error: The fallback itself may be invalid. Simplify it to a static value like
""to test. - Unexpected text results: If you used quotes around a number, remove them. Also check that the cell format is not set to text.
- Mobile app differences: Some functions may require the English function name even if your interface is in another language. If IFERROR is not recognized, try typing it in uppercase.
Frequently Asked Questions
What does IFERROR do in Google Sheets?
It returns a fallback value when the first argument produces any error, and otherwise returns the first argument's result.
Can IFERROR catch #N/A from VLOOKUP?
Yes, IFERROR handles #N/A and other common errors, making it ideal for lookups that may not find a match.
Is IFERROR available on the mobile app?
Yes, the function works in the Google Sheets Android and iOS apps, though the formula bar interface differs slightly.
What is the difference between IFERROR and IFNA?
IFNA only catches #N/A errors, while IFERROR catches all error types. Use IFNA when you want other errors to remain visible.
Can I use IFERROR with array formulas?
Yes, you can wrap an array formula or use IFERROR inside ARRAYFORMULA to apply error handling across a range. For example: =ARRAYFORMULA(IFERROR(A2:A10/B2:B10, "")).
Does IFERROR work with custom formulas or scripts?
IFERROR only handles errors from spreadsheet formulas, not from Apps Script custom functions. Those errors appear as #ERROR! and are not caught by IFERROR.