473,322 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

formula for calculating sales tax (GST)

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
Aug 31 '06 #1
5 39213
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+(GSTPercentage/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
Aug 31 '06 #2
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+(GSTPercentage/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
Aug 31 '06 #3
Alex,

Those Britain's are so clever, the Dutch tax rules are more like: Round at
xx and than always in your own benefit.

However probably are the taxes in Britain proud they still have pennies and
no cents, therefore they can still be penny wise and pound foolish.

Please don't see this a serious reply. I could not resist to sent it.

Cor

"Alex Turmer" <at*****@project-network.comschreef in bericht
news:e1**************@TK2MSFTNGP06.phx.gbl...
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+(GSTPercentage/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

Aug 31 '06 #4
Hi AJ

Thanks for the reply

Just what I wanted

Regards
Steve
"Alex Turmer" <at*****@project-network.comwrote in message
news:e1**************@TK2MSFTNGP06.phx.gbl...
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+(GSTPercentage/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

Aug 31 '06 #5
Hello Alex,

Other tax laws may apply as well. Like In Homer, AK (where I used to live)
there is a 5.5% sales tax.. but you can only be taxed on the first $500.00
of any single invoice. 3 miles down the road (literally) the tax drops to
2.0%, but the same upper limit applies (so you can't hard-code the max tax,
it has to be the max taxable).

I prefer to enter taxes as a decimal instead of a percentage.. so instead
of entering (or passing) 5.5, I would pass .055.

The formula then becomes..
Gross = Net + (Net * TaxDecimal)

Or in the case of Homer:
Gross = Net + ((Math.Min(MaxTaxable, Net) * TaxDecimal) + Math.Max(Net -
MaxTaxable, 0))

Enjoy,
-Boo
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+(GSTPercentage/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

Aug 31 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Syd | last post by:
The problem i have been asked to solve involves calculating commissions for a multi level marketing company. There are several products SAY A B C D and several Associates (or sellers). The...
3
by: Mike | last post by:
Hi, I have three tables in the following structure (simplified): Table 1: Containing the customers ------------------------------------------------- create table Customers ( int...
3
by: Wired Hosting News | last post by:
Lets say I have 10 products in 10 different stores and every week I get a report from each store telling me how many items they have left for each of the 10 products. So each week I enter in 100...
5
by: Wired Hosting News | last post by:
I tried to be breif and give a scenario so as not to be overlooked because it was soooo long. Let me give you real world. I am a manufacturer of goods and produce 11 items that are distributed...
1
by: mkheys | last post by:
Hi I have a database that I use for tracking ebay sales and profits. My sales table has a form that contains the ebay fees calculation but it won't update the sales table with the results from...
1
by: Victor | last post by:
Can someone help me with the formula(s) to calculate the RGB components for a gradient from green to red? I'm trying to display a nice graphic with a gradient that reflects the profit or loss and I...
33
by: pollyanna | last post by:
Hi there, I hope this is simple for someone. I always figure things out myself, but I thought it would be real nice to see if anyone else out there thought this was super simple and knew the...
3
by: muddasirmunir | last post by:
i am using vb6 and crystal report 10 with sqlserver 2000 i made a formulal field in crystal report 10 where i had a table name sales , it has two numeric fields credit and debit and give theme...
6
by: zelmila19 | last post by:
How do i write the formula for calculating the total sales and average for this program: while (sales !=-1) { i <= 12; i++; cout << fixed << setprecision(2) << "Please enter your sales...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.