A bank reconciliation that is "out" is a search problem. You have two balances that should agree, a list of entries, and one number: the difference. That number carries more information than people expect, and the checks that use it are simple enough to write in a few lines.
This is the logic behind our free Bank Reconciliation Difference Finder, reduced to the core.
Rule 1: money is integer cents
0.1 + 0.2 !== 0.3 in JavaScript, and a reconciliation tool that says "out by $0.0000000001" is worse than useless. Parse every amount to an integer number of cents once, at the edge, and never touch a float again.
function toCents(s) {
const m = String(s).trim().replace(/[,\s]/g, '').match(/^(-)?(\d+)(?:\.(\d{1,2}))?$/);
if (!m) throw new Error('Not an amount: ' + s);
const cents = Number(m[2]) * 100 + Number((m[3] || '0').padEnd(2, '0'));
return m[1] ? -cents : cents;
}
Rule 2: remove timing items before you diagnose
Deposits in transit and outstanding payments are not errors. Adjust the bank side first:
const adjustedBank = bank + depositsInTransit - outstandingPayments;
const diff = adjustedBank - books; // in cents
Rule 3: let the difference point at the entry
function candidates(diff, entries) {
const out = [];
const abs = Math.abs(diff);
if (abs === 0) return out;
// Transposition: swapping two adjacent digits always changes the amount by a multiple of 9
if (abs % 9 === 0) {
for (const e of entries) {
const d = String(Math.abs(e.cents));
for (let i = 0; i < d.length - 1; i++) {
const swapped = Number(d.slice(0, i) + d[i + 1] + d[i] + d.slice(i + 2));
if (Math.abs(swapped - Math.abs(e.cents)) === abs) out.push({ type: 'transposition', entry: e, correct: swapped });
}
}
}
// Wrong side: posting a debit as a credit doubles the error
if (abs % 2 === 0) for (const e of entries) if (Math.abs(e.cents) === abs / 2) out.push({ type: 'wrong-side', entry: e });
// Missing: the difference equals one entry
for (const e of entries) if (Math.abs(e.cents) === abs) out.push({ type: 'missing-on-one-side', entry: e });
return out;
}
Why multiples of 9? Swapping digits a and b in positions 10^k and 10^(k+1) changes the value by 9 · 10^k · (a − b). So the difference is always divisible by 9, and the size of the quotient tells you which digit pair moved.
Worked example
Books $8,430.00, bank $8,920.00, deposit in transit $400.00, outstanding payment $180.00.
Adjusted bank = 892000 + 40000 − 18000 = 914000 cents. Diff = 914000 − 843000 = 71000 cents ($710). Not divisible by 9, no entry of $355, but there is a $710 customer payment in the bank and not in the books: missing-on-one-side.
What the real tool adds
A form for balances, timing items and entries, every candidate listed with the arithmetic that proves it, any currency, and nothing you type is stored or sent. It is free: gettidycents.com/tools/bank-reconciliation-difference-finder.
Tidy Cents makes tools for running your business. No AI guesses: every result shows its working.
Top comments (0)