How to Avoid Divide by Zero Errors in Spreadsheets

I recently learned about the magic of the IF statement. No, not as a conditional in a programming language, but as a formula in a spreadsheet.

You know those stupid #DIV/0! errors you get after you’ve masterfully crafted a beautiful spreadsheet that doesn’t have any data in it yet?

This fixes that.

Here’s the syntax1:

=IF(CONDITIONAL, THEN, ELSE)

For example, if you want to display the results of A1 / A2 in A3, you’d use the following formula in A3:

=IF(A2=0, "n/a", A1/A2)

The second parameter (“n/a” above) can be anything you want, and is only displayed if the conditional is true.


  1. At least in Google Docs.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>