3 Replies Latest reply on Dec 4, 2007 11:38 AM by ssawka

# How can I subtract a percentage?

Is there a way to subtract percentages? Here is an example of what I need to do: 138 - 5% = 131.1

Some of what I have is...
<cfset HDQty = 6>
<cfset HDSAmplePrice = #getSamplePrice.HDPrice#>
<cfset HDSubTotal = #HDQty# * #HDSAmplePrice#>
<cfset HDDiscount = #getDiscount.DiscountAmt#>
This is where I don't know what to do, obviously if I just subtract the discount it minuses 5 not 5%
<cfset HDTotal = #HDSubTotal# - #HDDiscount #>

Any and all help is greatly appreciated!!!
• ###### 1. Re: How can I subtract a percentage?
quote:

Originally posted by: ICSchaef
Is there a way to subtract percentages? Here is an example of what I need to do: 138 - 5% = 131.1

Any and all help is greatly appreciated!!!

Write it out manually first.
138 - (138 * .05)
Then convert it to code.
• ###### 2. Re: How can I subtract a percentage?
Thanks so much for your help!!! It worked!!!
• ###### 3. Re: How can I subtract a percentage?
Alternatively:

138 * .95

or

138 * (1-.05)