Sliding scale discounts formula

401 Views Asked by At

I feel like there must be an easy way to calculate the following:

1 item = $10
2 items = $10 + ($10 * 0.9 * 1)
3 items = $10 + ($10 * 0.9 * 2)
4 items = $10 + ($10 * 0.9 * 2) + ($10 * 0.8 * 1)

In other words, offer a discount of 10% for the 2nd and 3rd items, 20% for the 4th-10th items, maybe 50% for the 11th+ item.

I'm looking for more than calculating how many items at each discount tier and applying the discount to each group, rather, is there a way to go about this in a single "pass"?

1

There are 1 best solutions below

6
On

This depends on what functions you're going to allow yourself. If we can use "max" (a function available in any spreadsheet) then it's not too bad:

$$p(n) = 10n - \max(n-1,0) - \max(n-3,0) - 3\max(n-10,0).$$

If you don't want max, then it's possible to pass a (very ugly) polynomial through the points, or maybe a Pade approximation. Or perhaps max can be replaced by Heaviside functions...?