New Tool Radar

AI for Data & Spreadsheets

How to Check an AI Formula for Rounding Errors in Totals

Find rounding errors in AI-built totals by comparing each rounded line value with the unrounded sum.

Schematic illustration for How to Check an AI Formula for Rounding Errors in Totals: three numbered steps - Show full precision first; Round only the display; Compare totals both ways.

Rounding each line to two decimals and then adding the rounded lines can give a total one penny away from the true sum, and an AI that rounds inside the formula hides the difference. The check keeps full precision in the calculation and rounds only the display, then compares the two totals.

Prerequisites

  • Excel or Google Sheets
  • A sheet with calculated line amounts
  • A copy of the source file, so the original stays untouched.

Steps

  1. Show the line amounts with full precision first, by widening the decimals, and note the unrounded total.
  2. Format the same amounts to two decimals for display, and add the displayed values by hand.
  3. Compare the hand total of the rounded lines with the unrounded total; a difference of a few pence is a rounding effect, not an error.
  4. If the AI formula rounds inside the calculation, replace it with a formula that calculates in full and rounds only at the total.
  5. Add a note on the sheet stating the rounding rule, so the next reader is not surprised by a one-penny difference.

Worked example: Fictional invoice lines with rounding

The practice table below is a fictional five-line invoice where each unit price has three decimals. The amount is the quantity times the unit price, shown to two decimals, and the total is the sum of the displayed amounts. The table below is fictional practice material, with fictional values. It is the expected result, worked out by hand, not a run of any tool.

Item Qty Unit Amount
Cable, 1 m 3 2.335 7.01
Cable, 2 m 2 4.165 8.33
Adapter 1 9.995 10.00
Battery 4 1.245 4.98
Tape 5 0.835 4.18
Total 34.50

Expected result. Five lines, each displayed amount is the rounded line value, and the displayed amounts add to 34.50. UNTESTED: no AI formula was generated for this guide; the table shows the expected values a check should produce.

Limits

  • Rounding inside a formula changes the value itself, so it should only be done deliberately.
  • A one-penny difference between two correct methods is normal; a larger difference is an error.

Sources

See all