• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How can I subtract a percentage?

Guest
Dec 04, 2007 Dec 04, 2007

Copy link to clipboard

Copied

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!!!
TOPICS
Advanced techniques

Views

567

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 04, 2007 Dec 04, 2007

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 04, 2007 Dec 04, 2007

Copy link to clipboard

Copied

LATEST
Alternatively:

138 * .95

or

138 * (1-.05)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 04, 2007 Dec 04, 2007

Copy link to clipboard

Copied

Thanks so much for your help!!! It worked!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation