Home > Archive > VBScript > November 2004 > Value Added Tax calculation
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Value Added Tax calculation
|
|
| m.salter 2004-11-25, 3:55 pm |
| hello all
i was helped by people from this group
to add 17.5% onto a variable number.
for that, i am very grateful.
i now need to calculate the VAT at 17.5%
from a variable number.
example
the amount value added tax in £100 is £17.50
preCalc = inputbox("Enter the sub total amount",,"100")
preCalc = (preCalc * 0.175) '
msgbox "Grand total: " &space(3) & (preCalc) & "%"
could i make a simple change to line 2 to do this
many thanks
| |
|
| m.salter wrote:
> hello all
>
> i was helped by people from this group
> to add 17.5% onto a variable number.
> for that, i am very grateful.
>
> i now need to calculate the VAT at 17.5%
> from a variable number.
>
> example
> the amount value added tax in £100 is £17.50
>
> preCalc = inputbox("Enter the sub total amount",,"100")
> preCalc = (preCalc * 0.175) '
> msgbox "Grand total: " &space(3) & (preCalc) & "%"
>
> could i make a simple change to line 2 to do this
Is this what you want?
msgbox posttax - (posttax / 1.175)
| |
| m.salter 2004-11-25, 8:55 pm |
| thanks Tom
but that code returns 0
preCalc = inputbox("Enter the sub total amount",,"100")
preCalc = (preCalc * 0.175) '
msgbox preCalc - (preCalc / 1.175)
would this make it work (just thinking aloud)
Dim preCalc ??
something is not working here, it's small code but incredibly painful
"Tom" <t@chip.ms.NOSPAM> wrote in message
news:%23HuiHaz0EHA.3096@TK2MSFTNGP10.phx.gbl...
> m.salter wrote:
>
>
> Is this what you want?
>
> msgbox posttax - (posttax / 1.175)
>
| |
|
| m.salter wrote:
> thanks Tom
> but that code returns 0
>
> preCalc = inputbox("Enter the sub total amount",,"100")
> preCalc = (preCalc * 0.175) '
> msgbox preCalc - (preCalc / 1.175)
>
> would this make it work (just thinking aloud)
> Dim preCalc ??
>
> something is not working here, it's small code but incredibly painful
Using Option Explicit at the very top of you script, and declaring variables
(Dim..) is a VERY good idea, even though you'll hate it.
You should also be using meaningful variable names.
Option Explicit
Dim pretaxinput
Dim posttax
pretaxinput = inputbox("enter pre-tax figure", "title", "100")
posttax = pretaxinput * 1.175
msgbox "net figure: " & pretaxinput
msgbox "vat element: " & (pretaxinput * 0.175)
msgbox "total inc vat: " & posttax
msgbox "vat element: " & (posttax - (posttax / 1.175))
msgbox "pre-tax: " & (posttax / 1.175)
| |
| m.salter 2004-11-26, 8:55 am |
| Thanks Tom
"Tom" <t@chip.ms.NOSPAM> wrote in message
news:uVcpQ3z0EHA.1404@TK2MSFTNGP11.phx.gbl...
> m.salter wrote:
>
>
>
> Using Option Explicit at the very top of you script, and declaring
variables
> (Dim..) is a VERY good idea, even though you'll hate it.
> You should also be using meaningful variable names.
>
>
> Option Explicit
> Dim pretaxinput
> Dim posttax
>
> pretaxinput = inputbox("enter pre-tax figure", "title", "100")
> posttax = pretaxinput * 1.175
>
>
> msgbox "net figure: " & pretaxinput
>
> msgbox "vat element: " & (pretaxinput * 0.175)
>
> msgbox "total inc vat: " & posttax
>
> msgbox "vat element: " & (posttax - (posttax / 1.175))
>
> msgbox "pre-tax: " & (posttax / 1.175)
>
>
>
>
|
|
|
|
|