# Percentages: Not a php question, but still...

#### Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

•  Subject
• Author
• Posted on
Hi,

I'm coding a PHP/MySQL application.
I'm looking for the formula to compute the original variable after it
has been applied VAT.
For instance 100 + 18% -> 118.
But if I try to find out 100 from 118 - 18%, the result is greater than
100.
I don't have enough maths background to solve the equation:
c = a + (a*b/100)
I'm stuck at this point:
a = (a*b/100) -c
I would like to have all 'a' on the left side and b and c on the right.

Can someone help?

## Re: Percentages: Not a php question, but still...

universalbitmapper wrote:

We know that the selling price of £1 560 is 130% of the cost price
since the dealer is making a profit of 30% on the cost price. So we can
say
£1 560 = 130/100 + cost price
Now multiply both sides of this equation by 100 and divide both sides
by 130. This gives
100/130 X  £1 560 = 100/130 X 130/100 + cost price = cost price
Since the two right-hand fractions cancel each other out.
Therefore the cost price to the dealer was £156 000/130 = £1 200.

ie 118000/118= 100

## Re: Percentages: Not a php question, but still...

100 / (100+VAT) * price with VAT = original price
100 / (100+18) * 118 = 100

I don't know the correct mathematical terms, but basicly this is what
happens:
the ratio of 100 : (100 + VAT) must be the same ratio as "original price" :
"VAT price"
100 / (100 + VAT) = original price / VAT price
multiply both sides with VAT price:

==> 100 / (100 + VAT) * VAT price = original price * (VAT price/VAT price)
==> 100 / (100 + VAT) * VAT price = original price

there you have it.

--
"Ohjelmoija  on  organismi  joka  muuttaa  kofeiinia  koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pivittyv nettisarjis
spam@outolempi.net || Gedoon-S @ IRCnet || rot13(xvzzb@bhgbyrzcv.arg)

## Re: Percentages: Not a php question, but still...

universalbitmapper:

Yes, because 18 % of 118 is greater than 18 % of 100, so 118 minus 18 %
of 118 is over 100.

Given your figures, you are trying to find x in

118/x = 118/100

that is, your figure after tax (118) divided by your figure before tax
(x) equals your tax rate(118 % not 18 %) divided by 100.

Multiplying both sides by 100,

=> 11800/x = 118

=> 118x = 11800

=> x = 100

ObOT:  "Standard" VAT in the UK is 17.5 %, no?

--
Jock

## Re: Percentages: Not a php question, but still...

usenet+2...@john.dunlop.name:

Scrub that.  Should be 'under 100'.

18 % of 118 is 21.24.  The result is less than 100.

--
Jock

## Re: Percentages: Not a php question, but still...

Who said anything about UK? There ARE other countries. :)

--
"Ohjelmoija  on  organismi  joka  muuttaa  kofeiinia  koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pivittyv nettisarjis
spam@outolempi.net || Gedoon-S @ IRCnet || rot13(xvzzb@bhgbyrzcv.arg)

## Re: Percentages: Not a php question, but still...

universalbitmapper wrote:

We know that the selling price of £1 560 is 130% of the cost price
since the dealer is making a profit of 30% on the cost price. So we can
say
£1 560 = 130/100 + cost price
Now multiply both sides of this equation by 100 and divide both sides
by 130. This gives
100/130 X  £1 560 = 100/130 X 130/100 + cost price = cost price
Since the two right-hand fractions cancel each other out.
Therefore the cost price to the dealer was £156 000/130 = £1 200.

ie 118000/118= 100

## Re: Percentages: Not a php question, but still...

price_without_wat = price_incl_vat / (100 + vat) * 100

In your example: 100 = 118 / (100 + 18) * 100

--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail