#Num!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • teneesh
    New Member
    • Mar 2007
    • 46

    #Num!

    One of my text fields in a report is:
    =Sum([ConfAttendance])/Sum([ConfOffrate])

    But how do I use the IIF statement on it to prevent the #NUM! error when dividing by zero?


    Thanks!
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi. Use of IIF to do this is
    Code:
    =IIF(Sum([ConfOffrate])=0, Null, Sum([ConfAttendance])/Sum([ConfOffrate]))
    I have placed Null as the return value, as it would be inappropriate to return a value in such circumstances. Theoretically the result of division by zero is infinity. If you need to return a value for any reason change Null to 0, but understand that it is not representing the result of the division itself.

    -Stewart

    Comment

    Working...