# Extract VAT with ghost cent

I have to write a math calculation to exctract VAT from a gross amount, but I think many online calculator are missing some particular cases.

Let's say we have 10% of VAT and a gross amount of 5.00€ what is the net and vat amount? The rounding rules says that I have to round half up the 5th thousandth.

The standard formula would be:

``````net= 5 / (1 + 10 / 100)
net = 4,545454545454545
net (rounded) = 4.55
``````

The problem is that: 4.55 + 10% = 5.01 and it exceeds the given gross amount

The previous cent has the opposite problem: 4.54 + 10% = 4.99 and it is less then the gross amount

So what is the right formula to exctract VAT?

• I assume the question was written specifically because of this very curious case and the only answer is that it should have been taught beforehand.... To answer the less important question: you just calculate your gross sales at the end of the month/quarter and pay your VAT to the government based on that. Clearly you keep the rounding cent (or you might even be rounding to the nearest dollar, depending on jurisdiction). This is purely hypothetical and not important in actual business Apr 3, 2020 at 18:21
• This is the point, I have to calculate gross/net for the single product sale and after sum all taxes, and not the opposite. This is why the right formula is important here. Apr 4, 2020 at 7:58