Categories
Work/Technical

Removing the VAT from a VAT Inclusive Price

Ok, so we just spent the last 30 mins figuring out how to remove the VAT (20%) from a VAT inclusive price.

The reason for this, is a customer of ours has an awesome online shop made by us – and all his prices are INCLUSIVE of VAT/Tax. He trades internationally, so we’ve been working on a cool EUVAT/Vat Exempt module so that (example) if someone buys from the EU and is EUVAT registered, they input their EUVAT number, the site instantly checks it for validity and if its OK removes the Tax/VAT from the order.

It has a whole heap of other “conditions” with it, but thats not the reason for this blog post.

We wanted to bulk remove the vat from his products, but our initial plan fell flat on its face, becasue;

£100 + 20% VAT = £120

£120 – 20% VAT = £96

Ah.

The reason for this is that 20% of 100 is not the same as 20% of 120….

So we racked our brains for all those formulas and junk we learnt in school, and asked a few friends who mostly pointed us to cool websites that seemed to do the job – but we were still no closer to actualyl figuring out what the formula was..

Then all of a sudden, bingo!

One of the lads figured it out, and here it is;

(total_price/(100+VAT))*100

So, as we break it down…..

(120/(100+20))*100

(120/120)*100

1*100

£100

Bingo! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *