Please enable JavaScript to view this site.

This program will calculate the percentage of parameter 1 using parameter 2 passing back the result in parameter 1.  This can be useful if needing to calculate a Discount or VAT for example. The program can handle both positive and negative values and will also remove any non numeric characters such as currency symbol , thousand delimiter etc. from the input string. Note: No currency symbol or thousand delimiter will be returned.

You can choose to add [*ADD] or subtract [*SUB] using parameter 3 the percentage to / from respectively from the input value giving a resultant value passed back in parameter 2. If you do not pass a variable in this parameter *ADD is assumed.

Depending upon what is passed in parameter 4 the program will either round [*YES] or truncate [*NO] the results returned to the number of decimals specified. If you do not pass a variable in this parameter rounding = *YES is assumed.

The default is to return the results as a two decimal numeric field of length eleven e.g. nnnnnnnn.nn [8 numeric the decimal point and two decimal]. The number of characters returned before the decimal point is always eight but you may alter the number of decimals by passing the value of 0 – 5 in parameter 6. If you alter the number of decimals returned then the return value length will change accordingly from 8 – 15 respectively. An extra “-“ character will be returned at the end of the string if the value is negative.

Parameter

In

Len

Out

Len

PARM1

Input Value

132

Percentage value

8 - 15

PARM2

Input Percentage

132

Resultant value

8 - 15

PARM3

*ADD or *SUB

4

-

 

PARM4

Round result *YES or *NO

4

-

 

PARM5

-

 

-

 

PARM6

No of decimals to return

1

-