# Capping part of a sum

I have a financial constraint which states that:

spend on x cannot exceed 15% of total spend, where spend on x is part of the sum of total spend, ie:

total spend = spend on x + spend on y + ...
but
spend on x <= 15% * total spend


Given the total spend and spend on x, how could I calculate capped spend on x?

-
if I understand meaning of capped spend correctly,(it being maximum amount you can spend on x), then it is nothing but $15 \%$ of total spend. What is the question then?? Please clarify the question.. – TheJoker Nov 15 '12 at 8:54
This part of a social responsibility calculation. So businesses can spend more than 15% on x, but only up to 15% will be recognised. – Gazza Nov 16 '12 at 5:47

If we start by calculating spend_on_other:

total_spend = spend_on_x + spend_other


therefore

 spend_on_other = total_spend - spend_on_x


Now we want to solve for capped_spend_on_x by assuming that spend_on_x is the maximum value (ie 15%), it follows that spend_on_other will be 85%. Since there is no cap on spend_on_other it follows that

capped_total_spend = capped_spend_on_x + spend_on_other


Given capped_total_spend is t,

t = 0.15t + spend_on_other


therefore

0.85t = spend_on_other


therefore

t = spend_on_other / 0.85


Having then the total capped_total_spend, we need only substitute

capped_spend_on_x = t * 0.15


therefore

capped_spend_on_x = (spend_on_other / 0.85) * 0.15


therefore

capped_spend_on_x = ((total_spend - spend_on_x) / 0.85) * 0.15

-