Prevent a #DIV/0 error

()

Here's a quick tip for avoiding #DIV/0 errors in Excel spreadsheets…

The tip

In Excel, doing math with cells treats blank cells as zero, so if you are ever dividing by cells values which may be blank, you get #DIV/0 errors. To avoid this, you can use this function to wrap your original formula, f:
=IFERROR(f, '')
Now if you have blank cells as inputs, whatever calculation uses them will be blank too. This transmits blank cells over division.

Example

This is useful, for example, if you are calculating price per square foot from a column of prices (column A) and a column of square footage (column B). Then, when you create a column (C) for the price per square foot with the formula something like:
=A1/B1
If you have some unknown square footage values in column B, so those unknown cells are left blank, and you want to avoid the ugly error value showing up in your C column, then you can change to formula to:
=IFERROR(A1/B1, '')
so the cells in the C column will be blank in the same row as the blank cells in the B column. This is what I mean by transmiting blank cells. The blank values propogate to the result column instead of an error showing up in the result column.

Bonus

If you know some Common Lisp, then you may recognize Excel's IFERROR as being similar in function to Common Lisp's UNWIND-PROTECT special operator.