# Formula for Calculating original quantities from a price

• September 16th 2010, 01:02 AM
dfahy
Formula for Calculating original quantities from a price
Hi I need a formula to solve the following problem, unfortunately my maths is pretty basic.

Item A = 0.23 per unit up to and including first 150 units
Item A = 0.18 per unit above 150 units
Item B = 0.15 per unit
Item A Quantity = 400 = (150 * 0.23) + (250 * 0.18) = 79.5
Item B Quantity = 400 * 0.15 = 60.0
----
Total Price = 139.5
----

Now if we have the Total Price, the percentage of the total price which was spent on Item B and the above per unit rates
how do you calculate what quantity of each item was brought originally.
It should be possible to get back to Item A Quantity 400 and Item B Quantity 300 given

Total Price = 139.5
Percentage of Total Price spent on Item B = 50%
Item A = 0.23 per unit up to and including first 150 units
Item A = 0.18 per unit above 150 units
Item B = 0.15 per unit

Thanks in advance for any help

Darren
• September 16th 2010, 01:39 AM
RHandford
Hi

First the % spent on B was not 50%.

However if you know the % you can do the following:
For B quantity=% of total value/unit price

For A:
First rough guess by doing remaining total value/0.23
If the result is > 150 (and in this case it is) then you have at least 150*0.23
so for the remainder (total value remaining-(150*0.23))/0.18

Hope that makes sense
• September 16th 2010, 02:02 AM
dfahy
Thanks for the answer, however in my haste I got the % wrong. I actually meant given the % of the quantity which was Item B, so it should have been

Total Price = 139.5
Percentage of quantity for Item B = 50%
Item A = 0.23 per unit up to and including first 150 units
Item A = 0.18 per unit above 150 units
Item B = 0.15 per unit

So from the Total order 50% of the quantity consisted of Item B

Darren
• September 16th 2010, 02:49 AM
Unknown008
Hm, let's define variables.

Let x be the number of items A.
Let y be the number of items B.

We know that Price for A = 0.23n (for $n\leq 150$) + 0.18(x - n)
Price for B = 0.15y

Now, total gives:

0.23 n + 0.18(x-n) + 0.15y = 139.5

Second equation:
x = y

Substituting in first equation:

0.23n + 0.18(x - n) + 0.15x = 139.5

Assuming that there is less than 150 items of a, makes x - n = 0 and x = n
0.23x + 0 + 0.15x = 139.5
x = 367

But x should have been less than 150!

So, we know that x is greater than 150, so, n = 150

0.23(150) + 0.18(x - 150) + 0.15x = 139.5
34.5 + 0.18x - 27 + 0.15x = 139.5
0.33x = 132
x = 400

So, y = 400