Pritcham wrote:
Hi Steve
I'm assuming you meant "Divide by 1.1" and not "divide by 11" as that
would appear to make no sense.
If that's the case then something along the following will do the job:
GST = TotalPrice/(1+(GSTPercenta ge/100))
Hope that helps
Martin
steve wrote:
>Hi All
Not sure if this is the right forum, but I need the formula for calculating
the amount of Sales tax (GST) from the tax included price
In Australia GST is 10% and the standard formula is to divide the total by
11 to get the gst amount
This is great until the GST % changes one day
So I need a formula to calculate the amount of GST using the gst% as an
input
I am using VB.net 2005
Any ideas
Regards
Steve
Guys,
Something has gone screwy here!
Divide by 11 is correct.
The total = net * (1 + tax%/100)
thus
net=total/(1 + tax%/100)
But - be warned, you simply cannot do sales tax this way. Each country
as strict laws which set the amount of decimal places the calculation
has to be correct to (in the UK is it 7). Then there is another set of
rules has to how to round a fractional result, in the UK that is halve
even if memory serves.
So your steps are this:
1) Make sure everything is in double precision - or use a big decimal class
2) Make sure you know the rounding rules
3) Make the calculation in three steps
Kind of like this - but must be tailored to your local laws
const oneHundred as double = 100.0
const one as double = 1.0
const rounder as double = 7.0
function GetTaxFromGross (taxPercent as double, gross as double)
dim tmpd as double
dim tmpl as long
tmpd=gross/(one + taxPercent/oneHundred )
tmpl=clng(tmpd * (rounder + one))
' Better check this - done from memory!
if tmpl mod 20 10 then
if tmpl mod 10 5 then
tmpl=tmpl + 10 -(tmpl mod 10)
else
tmpl=tmpl -(tmpl mod 10)
end if
else
if tmpl mod 10 5 then
tmpl=tmpl -(tmpl mod 10)
else
tmpl=tmpl + 10 -(tmpl mod 10)
end if
end if
return tmpl/rounder
end function
Please pleas please - note this code is a raw translation of the Java
version I wrote a couple of years ago - it is a guideline only - you
must spin your own!
Best wishes
AJ
www.deployview.com www.nerds-central.com www.project-network.com