dbTalk Databases Forums  

Dividing by zero

comp.databases.ms-access comp.databases.ms-access


Discuss Dividing by zero in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
zufie
 
Posts: n/a

Default Dividing by zero - 10-17-2008 , 10:43 AM






This is my original equation: =([Total Maintain Exercise]/[Total
Completing 1 mo Follow-up])*100

When the denomimator is zero I am unable to calculate the percentage.

I tried changing my equation to this format:
=IIf([denominator_field] = 0, 0, [numerator_field]/
[denominator_field])

I also tried:

IF(B=0,0,A/B) will give you an answer of 0 if the
denominator is zero or IF(B=0,"",A/B) will give you a blank in the
same
situation.

Any suggestions...I am desperate as I was hoping this would be an EASY
fix!

Thanks!,

John

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Dividing by zero - 10-17-2008 , 11:05 AM






zufie wrote:
Quote:
This is my original equation: =([Total Maintain Exercise]/[Total
Completing 1 mo Follow-up])*100

When the denomimator is zero I am unable to calculate the percentage.

I tried changing my equation to this format:
=IIf([denominator_field] = 0, 0, [numerator_field]/
[denominator_field])

I also tried:

IF(B=0,0,A/B) will give you an answer of 0 if the
denominator is zero or IF(B=0,"",A/B) will give you a blank in the
same
situation.

Any suggestions...I am desperate as I was hoping this would be an EASY
fix!

Thanks!,

John
Why not use/create a function in a code module?
Function DivideIt(a,b) As Variant
If b <> 0 then DivideIt = a/b
End Function
and insert as the control source
=DivideIt([FieldValue],[FieldValue]}


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.