← All how-to recipes

How to round line items before summing (and why totals look 'off by a cent')

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Make displayed line items and their total agree — invoices, currency reports.

The formula

AppFormulaNotes
Excel (desktop)=SUMPRODUCT(ROUND(A2:A10,2))Rounds each value THEN sums — matching what the reader sees line by line.
Google Sheets=SUMPRODUCT(ROUND(A2:A10,2))Identical; ARRAYFORMULA(SUM(ROUND(...))) also works.
LibreOffice Calc=SUMPRODUCT(ROUND(A2:A10,2))Identical.

How it works

Round-then-sum and sum-then-round genuinely differ: these two items display as 1.01 and 2.01 (summing to 3.02 in the reader's head), but their true sum 3.027 rounds to 3.03 — the infamous penny discrepancy. SUMPRODUCT(ROUND(range,2)) evaluates ROUND over the whole array first, so the total matches the printed lines. Which is 'correct' is a policy choice — invoices usually round per line (this formula); interest calculations usually keep full precision until the end.

Verified, not just documented

We ran =SUMPRODUCT(ROUND(A2:A3,2)) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 3.02 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 3.02 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

SUMPRODUCT · ROUND — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes

Related comparisons