Divide by Zero Return Zero

  • Thread starter Thread starter Ava
  • Start date Start date
A

Ava

=Avg(IIf([qryDRH_OBSbyMonthly]![dx_obs]<>"home",DateDiff
("h",([qryDRH_OBSbyMonthly]![obs_date]),
([qryDRH_OBSbyMonthly]![obs_disc]))))

This is my equation. It works for the most part but when
[dx_obs]<>"home" = 0 then it returns a null (divide by
zero) How can I make it return a zero if the equation
divides by zero??
 
Ava said:
=Avg(IIf([qryDRH_OBSbyMonthly]![dx_obs]<>"home",DateDiff
("h",([qryDRH_OBSbyMonthly]![obs_date]),
([qryDRH_OBSbyMonthly]![obs_disc]))))

This is my equation. It works for the most part but when
[dx_obs]<>"home" = 0 then it returns a null (divide by
zero) How can I make it return a zero if the equation
divides by zero??

I'm sorry, I see no division in this equation. Am I missing something?
 
This is a calulation based on a group in a report so it is
looking at a grouping and for all [dx_obs]<> home it is
taking the difference between 2 dates and then taking the
average of those differences. The problem is that when
[dx_obs]<> home = 0 the AVG function does not return
anything because there are zero records that fit the
criteria. I guess maybe I need to know either a better
way to write the equation or how I get the AVG function to
return a Zero even if there are no records that fit the
criteria.
-----Original Message-----
Ava said:
=Avg(IIf([qryDRH_OBSbyMonthly]![dx_obs]<>"home",DateDiff
("h",([qryDRH_OBSbyMonthly]![obs_date]),
([qryDRH_OBSbyMonthly]![obs_disc]))))

This is my equation. It works for the most part but when
[dx_obs]<>"home" = 0 then it returns a null (divide by
zero) How can I make it return a zero if the equation
divides by zero??

I'm sorry, I see no division in this equation. Am I missing something?


.
 
Back
Top