What you will build

Show a readable message when a divisor is zero or missing. This lesson uses fictional sample data so you can reproduce each action.

Learning objective

Complete the steps using the dataset below, explain why the feature or formula is used, and recognize issues when inputs change.

Prepare the sample data

Paste this example as tab-separated values beginning at A1 on a new worksheet:

HANDS-ON PRACTICE

Practice in your own copy

Make your own Google Sheets copy with the same data, formulas, formatting, filter and frozen header. The original remains unchanged.

Make a Google Sheets copy (access required) ↗View original

Sign in to Google. If the original is not publicly shared, download the full workbook and import it into Google Sheets, or paste the example data into your own sheet.

The Item, Revenue, and Units sample table in the source Google Sheets workbook.

Open the IFERROR sample workbook in Google Sheets ↗

Work through the example

Step 1: Enter =IFERROR(B2/C2,"Check units") in D2. With Revenue = 120 and Units = 2, D2 must return 60.

Step 2: Inspect the Notebook row where Units = 0. If the formula is copied to that row, the division errors and IFERROR returns Check units.

Formula to try

=IFERROR(B2/C2,"Check units")
Cell D2 selected with the IFERROR formula visible in the formula bar and result 60 in the table.

Checkpoint

ItemRevenueUnitsExpected result
Pen120260
Notebook2400Check units
Folder80180

D2 = 60 was verified live; the remaining rows show the expected result when the same formula pattern is copied down.

Common mistake and correction

If the result is unexpected, inspect the source cells, destination and referenced range in the formula. IFERROR handles any formula error, so using it too broadly can hide broken references. Investigate the underlying cause.

Independent practice

After following the example, complete this variation without editing the source data: Change a zero unit count to a valid number and verify the error message is replaced by a calculated value.

Key takeaways

  • ✓Show a readable message when a divisor is zero or missing.
  • ✓Create a per-unit metric in D2 using B2/C2.
  • ✓IFERROR handles any formula error, so using it too broadly can hide broken references. Investigate the underlying cause.
  • ✓Change a zero unit count to a valid number and verify the error message is replaced by a calculated value.
QUICK CHECK

Check your understanding

Answer four questions about the practice sheet.

1. Which first action belongs to this lesson?
2. Which formula is used in the example?
3. Which precaution matters for this lesson?
4. What is the independent practice task?

Continue learning

Previous lesson: IFS function; Next lesson: AND and OR functions.