July 25, 2007 at 8:10 am
I have an expression in a table cell where I could end up with a divide by zero. To handle this, I thought that I could us the IIF to check but it does not seem to be working.
Here is the basic syntax I am using, can someone tell me how to get around the error?
Note: X and Y are field values so this is just to illustrate the formula. Y could be zero so I would like it to default to zero for the true part of the iif, otherwise compute the calculation.
=iif(y = 0, 0, (x-y)/y)
July 25, 2007 at 2:00 pm
Have you tried the other way of phrasing it? iif(y0,(x-y)/y,0)
If that fails, then the problem is somewhere else. We would then like to see the surrounding code and the error message.
July 25, 2007 at 2:06 pm
I got around it by creating an embedded code function within the report. I have tried it the way you are suggesting and still get the error.
Thanks for your help.
July 26, 2007 at 4:27 am
Iff statements do not work for divide by zero checks as the report evaluates the espressions within the iff prior to doing the comparison. You must use custom code to solve this.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply