division by zero-PLEASE HELP

G

Guest

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

I get the division by zero error when running my query. How do I change my
formula to accept a zero value?????


Thanks
 
G

Guest

You can try checking if the [Sum Of SumOfTrue (-)] field equal 0, if so
return 0


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

John Spencer

You cannot ever divide by zero, so you need to test for that first with an
IIF statement. Something like the following

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

Guest

John and Linda's formulas both return a prompt that formula may be too
complicated (TELL ME ABOUT IT) and Cohen's formula still says divison by zero.

The field that has a 0 value is Sum of Sum of True (-)



John Spencer said:
You cannot ever divide by zero, so you need to test for that first with an
IIF statement. Something like the following

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

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

I get the division by zero error when running my query. How do I change
my
formula to accept a zero value?????


Thanks
 
J

John Spencer

That is usually an indication that someone messed up on the parentheses or other
syntax.
I think this may be correct.

IIF([Sum Of SumOfTrue (-)] + [Sum Of SumOfFalse (+)] = 0, Null,
([Sum Of SumOfTrue (-)]/
([Sum Of SumOfTrue (-)]+[Sum Of SumOfFalse (+)])) * 100 )

The best way to trouble shoot is to build this a bit at a time and see what
happens at each stage.

IIF([Sum Of SumOfTrue (-)] + [Sum Of SumOfFalse (+)] = 0, Null, "Calculate")

If that works then try adding in the formula a bit at a time. Perhaps the next
step would be

IIF([Sum Of SumOfTrue (-)] + [Sum Of SumOfFalse (+)] = 0, Null,
[Sum Of SumOfTrue (-)]+[Sum Of SumOfFalse (+)])

Tedious, but it will usually get you there.
John and Linda's formulas both return a prompt that formula may be too
complicated (TELL ME ABOUT IT) and Cohen's formula still says divison by zero.

The field that has a 0 value is Sum of Sum of True (-)

John Spencer said:
You cannot ever divide by zero, so you need to test for that first with an
IIF statement. Something like the following

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

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

I get the division by zero error when running my query. How do I change
my
formula to accept a zero value?????


Thanks
 

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

Similar Threads


Top