divison by zero

G

Guest

I have a query that has a value of zero (by calculation) and when I run my
query I get the error: divison by zero. I can't figure out how to set the
query to accept a NULL value.

Here is my formula:
Specificity %: (([Sum Of SumOfTrue (-)]/([Sum Of SumOfTrue (-)]+[Sum Of
SumOfFalse (+)]))*100)

Several of these SUM calculations are = to zero.

Thanks
 
G

Guest

Try this --
Specificity %: IIF(([Sum Of SumOfTrue (-)]+[Sum Of SumOfFalse (+)]))*100) =
0, "Your Error Message", (([Sum Of SumOfTrue (-)]/([Sum Of SumOfTrue
(-)]+[Sum Of SumOfFalse (+)]))*100))
 
G

Guest

You talk about a divide by zero error, then about accepting a Null value.
Those are two different things. Here is how you can avoid a divide by zero
error depending on what you want to return if the divisor is 0. The first
will return [Sum Of SumOfTrue (-)] unchanged (that is a horrible field name,
by the way. It violates almost every rule there is on naming fields). The
second example will return 0

Specificity %: (([Sum Of SumOfTrue (-)]/IIf(([Sum Of SumOfTrue (-)]+[Sum Of
SumOfFalse (+)])=0,1,([Sum Of SumOfTrue (-)]+[Sum Of
SumOfFalse (+)]))*100)

Specificity %: IIf(([Sum Of SumOfTrue (-)]+[Sum Of SumOfFalse (+)]) =
0,0,(([Sum Of SumOfTrue (-)]/([Sum Of SumOfTrue (-)]+[Sum Of SumOfFalse
(+)]))*100))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top