tags:

views:

438

answers:

2

In Australia we have to advertise products with tax already added, so rather than say a product is $10 + $1 GST = $11, we normally work backwards and say "ok, total is $10, how much of that is GST ?"

For example, for a $10 total, you do 10 * (1 /11) = 0.91, which is the tax component of the $10 total. My problem is I need calculate a formula for working out the taxable component when the tax rate is a variable. So far I've made this calculation although I'm not sure how correct an assertion it is:

10 * (1 / x) = 0.09 * (1 / y)

where y = 10, x = 11

Basically i want to work out x on the left hand side when I know that the tax rate is 0.05 for example, which will give me a formula that I can use to calculate the taxable component of an total figure. I want a function into which I can plug in the total price and the tax rate, and get back the taxable component of the total price.

I'd really appreciate the help with this as it really makes my head hurt ! :")

+1  A: 

If your taxrate is say x%, and your total amount is $y.

GST = y - y/(1+x/100)

Of course, if your taxrate is not in percent but is a fraction between 0 and 1, the formula gets

GST = y - y/(1+x)

Henri
+6  A: 

You are approaching this the wrong way:

totalPrice = taxablePrice * ( 1 + tax )

taxablePrice = totalPrice / ( 1 + tax )
Paulo Santos
Additional remark for the OP: "percent" is just "hundredths". I.e. if the tax rate above is "N percent", just write it as `N * 0.01`.
ndim