View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave F Dave F is offline
external usenet poster
 
Posts: 2,574
Default excluding #DIV/0! in further calculations

Fair point.
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"Harlan Grove" wrote:

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)