Dividing by zero

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zufie

    #1

    Dividing by zero

    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_fie ld] = 0, 0, [numerator_field]/
    [denominator_fie ld])

    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
  • Salad

    #2
    Re: Dividing by zero

    zufie wrote:
    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_fie ld] = 0, 0, [numerator_field]/
    [denominator_fie ld])
    >
    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]}

    Comment

    Working...