Re: Divide By Zero

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



To return Null

Average = IIF(SumB>0,SumA/SumB, Null)

"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:urqpE4TQGHA.4680@xxxxxxxxxxxxxxxxxxxxxxx
Paul W Smith wrote:
I am trying to set a calculated field which works out an average. My
problem is that sometimes the denominator is zero causing an issue.
If this is the case I would like to return a null or blank.

SumA/SumB = Average

How do I wrap my calculating code so I get my desired results?

Use "immediate if" - iif()

Average = iif(SumB>0,SumA/SumB, 999999999 )

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



.