View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
jamescox[_46_] jamescox[_46_] is offline
external usenet poster
 
Posts: 1
Default Divide by zero error


Really, that's probably the wrong way to approach the problem. A better
way would be to use data validation on the cells your formula references
so that user's can't enter zeros.

But if you want what you say you want, the simplest way to do it is
something like this:

=IF(ISERROR(((C13/C10)-E13)/((SQRT(E13*((1-E13)/C10)))*(SQRT(1-F10)))),0,((C13/C10)-E13)/((SQRT(E13*((1-E13)/C10)))*(SQRT(1-F10))))

Basically, that says If your original formula returns an error, return
a zero. If not, return the calculated value. I'm suggesting the
ISERROR function because (as you may have noticed) a value greater than
1 for F10 also causes your formula to generate an error.

You could simplify the above a bit by using just the denominator of
your calculation (the (SQRT(E13*((1-E13)/C10)))*(SQRT(1-F10)) piece )
because you can't get a divide by zero unless that piece evaluates to
zero. But if you just check to see if that is zero, you miss the
'protection' of detecting the issue of the F10 value I mentioned above.

Hope this helps...


--
jamescox
------------------------------------------------------------------------
jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=113585