Why invoice totals drift by a cent
A discount across two tax rates, a currency with three decimals, and a total that is one cent off. Where the cent goes, and why it is not arbitrary.
Put two tax rates on one invoice, apply a discount to the whole thing, and there is a decent chance your spreadsheet's total disagrees with the sum of its own tax lines by a cent. It is not a bug in the spreadsheet. It is a question the spreadsheet was never asked.
Where the cent comes from
A document-level discount has to be split across the tax rates it touches, because each rate's tax is calculated on its own reduced base. Split 100.00 proportionally between a 20% base and a 5.5% base and you will land on fractions of a cent — and a cent cannot be split. Somebody has to receive the leftover.
Round each share independently and the shares no longer sum to the discount. Round the total separately and the breakdown no longer reconciles. Either way the invoice contains two numbers that contradict each other, and the person reconciling it has no way to tell which one is right.
Largest remainder, in minor units
The fix is to stop working in decimals. Convert to minor units — cents, centimes, fils — allocate the whole amount as integers, and hand the remaining units to the shares with the largest fractional parts. Every unit is accounted for, the shares sum exactly to the discount, and the breakdown adds up to the total by construction rather than by luck.
Why it is not done in your browser
Because the browser and the PDF renderer would then be two implementations of the same rule, and two implementations agree right up until they don't. On this site the totals are calculated once, on the server, and the same figures are printed into the PDF and sent back to the page. The sheet you watch while typing shows those returned figures — dimmed while the next save is in flight, never quietly replaced with a guess.
Before the very first save there is nothing to show yet, so the sheet does its own arithmetic and labels the result provisional. It is the one place a figure here is computed in a browser, and it says so.
What this means for you
- Put the real rate on each line. Several rates on one invoice is normal, not an edge case.
- Apply discounts wherever they belong — per line or across the document. The allocation is handled either way.
- Read the totals block, not your own mental arithmetic. If they differ, the totals block is describing the currency's rules more carefully than you are.


