Expression Question (1 Viewer)

A

artifex

Guest
I have a expression in a form field that is supposed to produce a percentage. (Bid - actual = diff) (diff/bid = percentage)
When all the fields are filled in and the difference is a positive number, everythings fine. However if the difference is a negative number or if there are zero values in all the fields, one of two errors are returned. Either #Div/0! or #Num!. Can any one help me start to trouble shoot? or define the error messages? Thanks!
 

Charlie

Registered User.
Local time
Today, 09:37
Joined
Jan 7, 2000
Messages
16
Dear Artifex,

Anything that is divided by zero will be infinity so thats your biggest problem.

I have had similar problems so what I do is this (v.easy):

If bid = 0 then
percentage = 0
else
diff/bid = percentage
end if

With the 'diff' thing it's important that if the 'actual' is more than the 'bid' that this is shown as a negative but the maths may not work out if its negative. So you maybe need to write something that makes the number positive, does the maths and afterwards makes it negative again (if it needs to be).

I hope this helps a little,

Charlie
 

Users who are viewing this thread

Top Bottom