# Calculate reduction percentage

## Recommended Posts

Hi friends,

I have a case where the user will enter a original price and a new reduced price, and we want a field to be calculated with the reduction percentage (-30%, -40%...).

Like in this screenshot :

http://forums.printable.com/attachment.php?attachmentid=981&stc=1&d=1392991331

The user will enter 119.99 and 69.99 and we would like the "-41%" to be calculated using a rule.

How may we do that ?

Using FP 9.1 and MarcomCentral.

Olivier from France

##### Share on other sites

Please note I used the Math.ceil property since we are dealing with negative numbers.

```var was = Int(Field("was price")); // 119.99
var now = Int(Field("now price")); // 69.99
var reduction = Math.ceil(((now - was) / was)*100) + "%";
return reduction;
```

##### Share on other sites

Thank you Step, it is very simple !

Have a nice day,

Olivier

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• #### FusionPro.com

• MarcomCentral
×
• Create New...