E9.2 How to check for a negative number

What I am looking to do is look at an amount, if the amount is not a negative value I need to update the value to be negative. I would think I could check if the amount is less than zero to determine if the amount is negative, but I am not sure how to change the amount to be a negative amount.

Thank you.
Jill
 
What I am looking to do is look at an amount, if the amount is not a negative value I need to update the value to be negative. I would think I could check if the amount is less than zero to determine if the amount is negative, but I am not sure how to change the amount to be a negative amount.

Thank you.
Jill

Hi Jill,

Another option would be to use an Absolute value function (if available) removing the need for the "IF" construct and allowing it to be used within larger calculations:

Code:
mnValue = ABS(mnValue) * -1
 
Hi,
If you need to shave nanoseconds off your calculation, subtracting from zero might be more efficient, like: mnValue = 0 - ABS(mnValue). But Peter's option is quicker to understand at a glance.
 
Back
Top