Forum Discussion

iowakrz's avatar
iowakrz
Frequent Visitor
7 years ago

Using IF statement to convert a number to negative

The AMOUNT field is a positive number and DOCTYPE determines if the record is a sale or a return.  I want to convert the AMOUNT to a negative number in my dataset if it is a return and keep it positive if it is a sale.  Doctype=5 for returns and 6 for sales.  In Excel I would normally do the following but that doesn’t work.  What is the correct syntax?  Thanks for any help you can provide.

 

=IF(SOP30200[DOCTYPE]=5,-SOP30200[AMOUNT] , SOP30200[AMOUNT])