ARDHOLT Excel & VBA Casebook · all cases

Paid invoice, wrong total

The payment covers the lines below, but the invoice asks for £2.35 too much. The check keeps that difference open for review.

INV-0017 source beside Ledger row 18. Net £227.49 + tax £10.63 = gross £238.12. Stated £240.47 − calculated £238.12 = £2.35 to review. Gross £238.12 − recorded payment PAY-0017 £238.12 = £0.00 remaining. Payment covered; invoice total still needs checking.

Trace this check: source invoice and payment · ledger row · line calculations · £2.35 review entry.

120 invoices checked; 7 totals need review. The checked workbook keeps the total check separate from the payment check.

Case 06 of 8 in Excel & VBA casebook

What was wrong

What I did

Proof

The Payment list in the checked workbook shows each invoice’s payment position. Entries with questionable payments are marked Check payment, so they can be reviewed before asking someone to pay again.

What you can see Result from these files
Invoices checked 120 invoices, with 360 lines
Totals needing review 7, overstated by £16.45 altogether
Payments matched to invoices £40,326.02 across 119 entries
Repeated payment references 6 entries sharing 3 references, set aside for checking
Payments with no matching invoice 4 entries, £183.15 altogether

Every payment entry is kept in the payment file. The repeated entries need checking against the payment records before anyone can say how much of them was actually received. They are not counted as additional money received.

Follow the invoice in the first image

The image is a compact view of INV-0017 from the supplied workbook beside its checked ledger entry. It shows the full check, without cropping a longer payment list.

In input.xlsx, the invoice is on Invoices row 18, its lines are on Lines rows 50–52, and PAY-0017 is on Payments row 18. The corresponding checked workbook entry is Ledger row 18; its total_check is REVIEW even though its payment balance is SETTLED.

Line Net calculation (£) Tax calculation (£) Gross (£)
L01 4 × 21.93 = 87.72 87.72 × 0% = 0.00 87.72
L02 5 × 23.10 = 115.50 115.50 × 5% → 5.78 121.28
L03 1 × 24.27 = 24.27 24.27 × 20% → 4.85 29.12
Total 227.49 10.63 238.12

These values are in lines.csv. Net and tax are each rounded half-up to pennies per line before summing. The invoice ledger records £227.49 + £10.63 = £238.12, and £240.47 − £238.12 = £2.35 to review. The payment file records PAY-0017: £238.12, giving £238.12 − £238.12 = £0.00 remaining against the calculated total. The exception remains open; the stated invoice has not been silently changed.

Download: original workbook · checked workbook with payment list · invoice views · entries to review · full reconciliation

Developer details: reproduce the results and inspect the checks

Try it yourself — optional developer check

A developer can reproduce the checks with Docker from this case folder:

./run.sh

It rebuilds the files and prints PASS or FAIL. Setup and instructions for another input workbook.

How it is tested

The verification record is a historical run; its source hashes identify that snapshot, not the current rendering/page sources.

Tests

The .xlsx workbooks were produced with Python 3.12.3 and openpyxl 3.1.2, then checked with LibreOffice 24.2.7.2: all 1,920 recalculated formula cells matched. 31 tests passed, covering rounding, refunds, part-payments, repeated payment references and payments with no matching invoice. The tests also check that no records disappear, the input stays unchanged and repeat runs give the same result. Tests · replacement-input checks · technical rules and workbook tabs.


The files above show 120 invoices. The offer below covers a smaller batch; for your larger pile, I quote the total through the platform before I start.

£10 fixed, up to 20 invoices, net/VAT/gross that checks itself, 2 working days. Contact me through the platform where you found this case.

This case at its size (120 invoices): £60 fixed, £10 for each 20 invoices.

More rows or pages: I quote the difference in writing before I start.