View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default excluding #DIV/0! in further calculations

Dave F wrote...
When I see #DIV/0! errors in my spreadsheets, I trap those errors,
to avoid problems such as yours.

Assume I have the formula =A1/A2 and A2 can equal 0. I would trap
the #DIV/0! error by modifying the formula:
=IF(ISERROR(A1/A2),"",A1/A2)

....

But that traps any error in either cell A1 or cell A2. The only ways
A1/A2 returns #DIV/0! is if either A1 or A2 already evaluates to #DIV/
0! or A2 = 0. Usually a good idea to propagate UNEXPECTED errors and
only trap EXPECTED errors, so better to use

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