The Feed Doctor Returns: Percentage Savings Rule

September 30, 2011

Digital Marketing ChannelAdvisor By ChannelAdvisor

25OFF Recently I’ve been asked how to create a rule to generate a “percent
savings” message. Let’s say your sale price is in an attribute called
$itemstoreprice, and the regular price is $itemretailprice. The formula
for percent savings is:

100 * (1 – $itemstoreprice/$itemretailprice)

Here’s the result for an item that’s marked down to 14.99 from 19.99:

Well, that’s kind of ugly. Maybe I only want whole numbers. That’s easy to
do with the FORMATNUMBER function:

FORMATNUMBER (100 * (1 – $itemstoreprice/$itemretailprice), “F0”)

That “F0” means to output a Fixed number of digits to the right of the
decimal; in this case, zero digits.

And here’s the result: 25

If you wanted two digits to the right of the decimal instead of “F0” you’d
have “F2” and the result would be 25.01.

Let’s stay with “F0,” and some text:

$itemstoreprice/$itemretailprice), “F0″),”% off retail!”)

Here’s the result:

Save 25% off retail!

Blogpost by Anthony Alford: The Feed Doctor