View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mark mark is offline
external usenet poster
 
Posts: 196
Default Format of textbox on userform and correct result

I amusing Excel 97.

I am trying without much look to calculate the VAT and
have used the following.

txtVAT1.Value = Format((Val(txtT1.Value) + Val
(txtNT1.Value)) * (Val(txtT1.Value) + Val
(txtNT1.Value)) / 17.5, "£##.00")

Firstly, when I use the above formula and say the value
of txtT1 is £9 and the value of txtNT1 is £1 the sum is
£10 and the VAT amount is correctly calulated to £1.75.

However if I changes to values to £90 & £10 respectively
then the result of the VAT is £175!!

Secondly, how do you force the txtbox to only 2 decimal
places I have tried the above and it's very hit and miss.

The whole problem is obviously to do with decimal spaces
but I'm stuck any takers?

Regards

Mark