You can build a statement reconciliation in Excel VBA by importing the bank statement and your ledger into two worksheets, matching rows on amount and date (or a unique reference), and writing the unmatched rows to a third sheet. The shortest working approach is a loop over one list using a dictionary keyed on amount plus date, flagging each match and leaving the rest as reconciling items. This guide walks through that build step by step, with the pitfalls that cause false matches and the checks that catch them.

What You'll Need

  • Excel on Windows or Mac with macros enabled (the VBA editor is included in every desktop edition; the browser version cannot run macros).
  • Two clean data sets: the bank statement export and your ledger or transaction list, each with a date column, an amount column and ideally a reference or description column.
  • Both lists saved in the same workbook, on separate sheets, with headers in row 1 and no blank rows in the middle.
  • Amounts stored as numbers, not text, and dates stored as real dates. This is the single biggest cause of failed matches.
  • A spare sheet for the output, and a copy of the workbook before you run anything that writes data.

Step-by-Step

  1. Prepare the workbook. Put the statement on a sheet named Statement and your ledger on a sheet named Ledger. Keep the same column order in both: for example A = Date, B = Description, C = Reference, D = Amount. Delete totals rows, blank rows and any header repeats before you start. Save a backup copy.
  2. Normalise the amounts. Select the Amount column on each sheet, open Format Cells (Ctrl+1 on Windows, Cmd+1 on Mac) and confirm the format is Number, not Text. If amounts arrived as text, use Data > Text to Columns or multiply by 1 in a helper column to convert them. Decide a sign convention: money out as negative on both sheets, or use absolute values on both. Mixing signs will halve your matches.
  3. Normalise the dates. Confirm the Date column is formatted as Date. If dates imported as text, use Data > Text to Columns and choose the correct date order for your region. Statement dates and ledger dates often differ by a day or two because of clearing time, so plan to match on a date window rather than an exact date.
  4. Open the VBA editor. Press Alt+F11 on Windows or Fn+Alt+F11 on Mac. In the Project window, right-click your workbook, choose Insert > Module. Labels in the editor can vary slightly by version, but Insert > Module is present in all current desktop builds.
  5. Write the matching routine. The core pattern is a dictionary keyed on a rounded amount plus a date bucket. A simple version: loop the statement rows, build a key from Round(Amount, 2) & "|" & Format(Date, "yyyy-mm-dd"), and store the row number in a Dictionary. Then loop the ledger rows and test the same key. When a key exists, mark both rows as matched and remove the key so a second ledger row cannot claim the same statement line. Anything left unmatched on either side is a reconciling item.
  6. Handle near-matches deliberately. If exact date matching leaves too many open items, allow a window: for each ledger row, try the key for the date, then the date minus one day, then plus one day. Only widen the window if you can explain why the dates drift, and record which window was used so the output is auditable.
  7. Write the output. Create or clear a sheet named Recon. Write three blocks: matched pairs (statement row, ledger row, amount, date), unmatched statement lines, and unmatched ledger lines. Add totals for each block. The difference between the two unmatched totals should equal the difference between the statement closing balance and the ledger closing balance; if it does not, your opening balances or sign convention are wrong.
  8. Add a summary. At the top of the Recon sheet, put the count and total of matched items, unmatched statement items and unmatched ledger items. This is what you review first each period, before drilling into individual lines.
  9. Run and review. Press F5 with the cursor inside the routine, or run it from Developer > Macros. Review the unmatched lists line by line. Common genuine reconciling items are bank charges, interest, uncleared cheques and timing differences; common false ones are duplicate references, split transactions and sign errors.
  10. Save as a macro-enabled file. Use File > Save As and choose the macro-enabled workbook format so the code survives. Keep the raw exports untouched on separate sheets so you can rerun the reconciliation after correcting data.

Common Mistakes

  • Matching on amount only. Two transactions of the same value on different dates will pair up wrongly. Always include a date or reference component in the key.
  • Leaving amounts as text. The dictionary key then contains invisible differences and nothing matches.
  • Forgetting to remove a key after a match, so one statement line absorbs several ledger lines.
  • Mixing sign conventions between the two sheets, which produces a large unexplained difference.
  • Rounding inconsistently. Round both sides to two decimals before building the key.
  • Writing output over the source data instead of to a separate sheet.
  • Running the macro twice without clearing the Recon sheet, so results duplicate.

Tips

  • Use a Dictionary rather than nested loops; it turns a slow comparison into a fast lookup even on thousands of rows.
  • Keep a helper column that concatenates date and amount on the sheet itself, so you can spot-check the key logic with filters before trusting the macro.
  • Log every run: timestamp, row counts and totals written to the Recon sheet. It makes month-to-month review far easier.
  • Test on a small sample first, ideally with one deliberate duplicate and one deliberate date drift, so you can see how the routine behaves.
  • If your bank export changes column order between downloads, read columns by header name rather than fixed position.

Troubleshooting

  • Nothing matches. Check amount format and sign first, then date format. Compare a known pair by eye and inspect their underlying values in the formula bar.
  • Too many matches, wrong pairs. Your key is too loose. Add the reference column or tighten the date window.
  • Runtime error on the Dictionary. Add the reference to the scripting library through Tools > References in the VBA editor, or use a Collection or a worksheet-based lookup instead.
  • Macro will not run. Check that the file is saved in a macro-enabled format and that the folder is trusted, or enable macros for that session only. Do not lower security settings permanently.
  • Totals do not tie. Recheck opening balances, sign convention and whether any rows were excluded by blank cells or filters.
  • Results change between runs. The source data probably changed, or the Recon sheet was not cleared. Clear output first and compare row counts.

Frequently Asked Questions

Can I reconcile without VBA?

Yes. Power Query and lookup formulas can do much of the same work, and they are easier to audit. VBA is worth it when you repeat the process often or need custom matching rules.

Does this work on Excel for Mac?

The VBA editor and Dictionary approach work on desktop Mac Excel, though shortcut keys differ and some library references need adjusting. Excel for the web cannot run macros.

How do I handle one payment covering several invoices?

Match at the payment level first, then split the ledger rows manually or add a grouping key so the routine can sum several ledger lines against one statement line.

Should I match on description text?

Only as a tie-breaker. Descriptions vary between bank and ledger, so use amount and date as the primary key and the reference as a secondary check.

How large a file can this handle?

A dictionary-based loop handles tens of thousands of rows comfortably. Performance problems usually come from cell-by-cell reads; read ranges into arrays instead.

Is it safe to run on live data?

Work on a copy and write only to a separate output sheet. Never let the routine overwrite the original exports, and keep the backup until the reconciliation is signed off.