Creating and Using Basic Formulas: Handling Errors in Formulas in Google Sheets

When creating spreadsheets, especially when using Google Sheets, one of the most valuable skills is the ability to work with formulas. Formulas are essential for performing calculations, analyzing data and automating tasks. However, it is common to encounter errors when dealing with formulas, whether due to invalid entries, incorrect cell references, or other problems. Fortunately, Google Sheets offers specific functions to handle these errors, such as IFERROR and ERRORS.

Understanding Errors in Formulas

Before we dive into how to handle errors, it's important to understand the types of errors that can occur in a formula. Here are some of the most common errors in Google Sheets:

  • #DIV/0!: Occurs when a formula attempts to divide a number by zero.
  • #N/A: Means "Not Available" and appears when a value is not available for a formula or function.
  • #NAME?: Appears when Google Sheets does not recognize the text in the formula.
  • #NUM!: Indicates that there is a problem with a number in the formula, usually related to a function that expects a specific number type.
  • #REF!: Happens when a cell reference is not valid, usually due to a cell being deleted or moved.
  • #VALUE!: Appears when the value type is incompatible with the expected operation or function.

IFERROR function

The IFERROR function is a powerful tool for capturing and handling errors in formulas. It allows you to specify an alternative return value if the main formula results in an error. The syntax of the IFERROR function is as follows:

=IFERROR(value; value_if_error)

Where:

  • value: is the formula or expression you want to calculate.
  • value_if_error: is the value that will be returned if the main formula results in an error.

For example, if you have a formula that divides two numbers and you want to avoid the #DIV/0! error, you can use IFERROR as follows:

=IFERROR(A2/B2; "Division by zero!")

In this case, if B2 is zero and the division results in an error, the cell will display the message "Division by zero!" instead of standard error.

ERROR function

While IFERROR allows you to specify an alternative value in case of an error, the ISERROS function is used to check whether an expression results in any error. The ERROR function returns TRUE if the evaluated expression results in an error and FALSE otherwise. The syntax is simple:

=ISERRORS(value)

Where:

  • value: is the formula or expression that you want to test for error.

For example, to check whether a given formula in A2 results in an error, you would use:

=ERROR(A2)

If A2 contains an error, the function returns TRUE; otherwise it will return FALSE.

Combining ISERROR and ERRORS

These two functions can be combined to create robust error checking and handling in your formulas. For example, you may want to check whether a formula results in an error before performing a subsequent calculation:

=IF(ISERRORS(A2/B2); "Check the values"; A2/B2 * C2)

In this example, if the A2/B2 division results in an error, the cell displays the message "Check values." If there is no error, the cell will display the division result multiplied by C2.

Tips for Error Handling

Here are some additional tips to help you effectively handle errors in your Google Sheets spreadsheets:

  • Use IFERROR to prevent errors from appearing to end users. This can be particularly useful in shared spreadsheets or reports.
  • Customize error messages with IFERROR to provide clear instructions on how to fix the problem.
  • Combine ERRORS with other conditional functions, such as IF and CHOOSE, to create more complex error logic.
  • Test your formulas with different types of input to ensure error handling is working as expected.
  • Use the ERRORS function to avoid unnecessary calculations or to trigger other actions in case of an error.
  • Document the formulas and error logic so that other users can understand how and why errors are handled in a certain way.

In summary, understanding how to create and use basic formulas in Google Sheets is crucial, and knowing how to handle errors is an essential part of that knowledge. With the appropriate use of the IFERROR and ÉERROS functions, you can ensure that your spreadsheets are more reliable and user-friendly, avoiding confusion and ensuring integrity.data.

Now answer the exercise about the content:

Which of the following statements about formula error handling in Google Sheets is true?

You are right! Congratulations, now go to the next page

You missed! Try again.

Article image Creating and Using Basic Formulas: Naming Ranges to Simplify Formulas

Next page of the Free Ebook:

19Creating and Using Basic Formulas: Naming Ranges to Simplify Formulas

4 minutes

Obtenez votre certificat pour ce cours gratuitement ! en téléchargeant lapplication Cursa et en lisant lebook qui sy trouve. Disponible sur Google Play ou App Store !

Get it on Google Play Get it on App Store

+ 6.5 million
students

Free and Valid
Certificate with QR Code

48 thousand free
exercises

4.8/5 rating in
app stores

Free courses in
video, audio and text