Reply To: Subtracting Percentage from Pricing Script

#95268
Peter Kahrel
Participant

Scott,

To subtract a percentage, multiply the number by 100 minus the percentage. So to subtract 25% off prices, multiply by 0.75. I can’t remember if NumberAdjuster lets you set the number of decimals — if it can, use that. If it can’t, use this script:
https://www.kahrel.plus.com/indesign/price_adjuster.html
(which is a merge of NumberAdjuster and Olav Kvern’s PriceUpdateByString script). Indicate that you want two decimals. If that doesn’t give you the desired rounding (can’t remember now what the script does), then run it and use three or even four decimals.

To get rid of the third and maybe the forth decimal, use this GREP query:

Find what: [$\d,]+\.\d\d\K\d+
Change to

This query says ‘match any digits that are preceded by a dollar symbol followed by any digits and commas followed by a dot and two digits and delete them’. So it chops the third and any following digits off your prices.

Peter

This article was last modified on June 9, 2017

Comments (0)

Loading comments...