Journal Entry Testing with AI: Prove the Population, Then Score Every Entry
Journal entry testing has two parts, and most of the risk sits in the first. Before you score or select anything, you need to know you hold every journal that moved the ledger. Then you need selection criteria you can write down, apply to every entry and defend to a reviewer. A quarter's journal extract can run to hundreds of thousands of lines, which is too many for a spreadsheet and exactly right for a script.
An AI tool can write that script from the column headers and run it on your laptop, without the journal lines going anywhere.
The rule: let the AI write the script, not read the data
Claude Code is Anthropic's AI tool that works on files on your own computer. It needs a paid Claude plan, and your organization should approve it for financial data before you start.
The model runs on Anthropic's servers, so whatever Claude Code reads, it sends. If it opens the journal extract, the lines go to the provider. Journal descriptions in particular can reveal far more than amounts. So ask it to read only the headers, write a Python script, run the script locally and print only counts and totals. The script reads every line on your machine; the detail is saved to a workbook you open yourself.
This is a working habit, not a security boundary: anything printed is sent, and an approved script runs with your access. Work in a folder holding only the copies you need, use Manual mode, and read each permission prompt.
What you need
JE_Lines_Q4.csv: journal lines with Journal ID, Line, Account, Debit, Credit, Period, Source, Created By, Approved By, Created Timestamp and Posted DateTB_2026-09-30.xlsxandTB_2026-12-31.xlsx: opening and closing trial balances (Account, Description, Balance)JE_Criteria_Q4.xlsx: your criteria and weights, written before the run (more on this below)
When you request the extract, put the exact columns, date range, entity and format in writing, and ask for the report name and the parameters used to run it. That one email covers much of the evidence on how the data was produced.
Step 1: Prove the population is complete
For every GL account, the opening trial balance plus the net of the period's journal lines should equal the closing trial balance. If every account rolls forward, you hold every journal that moved the ledger. If one doesn't, the extract is missing something: a source, a ledger, a period, or top-side entries.
These files are company financial data. Do not open or print their rows. Read only the column headers. Write a local script je_rollforward.py that: 1. Sums Debit minus Credit by Account from JE_Lines_Q4.csv for periods Oct-26, Nov-26 and Dec-26 only. 2. For every account in either trial balance or the journals: Opening + Net Journals - Closing = Difference. 3. Checks that each Journal ID balances and lists any that don't. 4. Lists journals whose Period falls outside Q4, and accounts in the journals but in neither trial balance. Write JE_Completeness_Q4.xlsx with sheets: Roll-forward (all accounts), Differences (non-zero only), Unbalanced Journals, Out of Period, and Parameters (files, row counts, total debits and credits, date run). Print only: row count, total debits, total credits, accounts with a difference, and the largest absolute difference.
Every account gets a line, including those with no activity, so a missing account shows up rather than hiding. Unbalanced and out-of-period journals each point to a different extract problem.
Step 2: Write the criteria down before you run anything
Typical criteria include manual entries to revenue or reserve accounts, entries created and approved by the same user, postings by unusual or senior users, amounts just below an approval threshold, entries posted after the close date into the closed period, weekend or after-hours postings, and round amounts. No single flag means much. Several on one entry usually do.
Put the criteria, the weights, the list of usual posters, the approval thresholds, the close date and the holiday calendar in a workbook. The weights are your judgment, fixed before the run, not tuned afterwards to produce a tidy list.
Step 3: Score every entry
Read only the headers of JE_Lines_Q4.csv. Read JE_Criteria_Q4.xlsx in full (it contains no transaction data). Write a local script je_scoring.py that aggregates lines to Journal ID and scores each manual journal (Source = Manual) using the weights on the Criteria sheet: revenue or reserve account; Created By equals Approved By; creator not on the usual posters list, or on the senior users list; total within 5% below an approval threshold; Posted Date after the close date for a Q4 period; created on a weekend, holiday, or outside business hours; amount a multiple of 10,000. Keep all weights, times and percentages as settings read from the Criteria sheet. Write JE_Scored_Q4.xlsx with: Scored Journals (one row per journal, one Y/N column per criterion, and the score), Score Distribution, By User, Benford (first-digit counts against expected proportions, for information only), and Parameters. Print only the score distribution.
Two design points matter. Scoring at journal level means a large entry split across many lines is still one entry with one score. And one Y/N column per criterion lets a reviewer see why an entry scored what it did, and re-perform it.
Benford's first-digit analysis can sit alongside as a pointer. If far more amounts start with one digit than the expected curve suggests, look at which users and accounts drive it. It tells you where to look, never what happened, so keep it out of the score.
Step 4: Select, then test
You choose which entries to test, using the scores and what you know about the close. Then:
From JE_Scored_Q4.xlsx, take the journals I have marked "Select" in the Selection column. Build JE_Test_Sheet_Q4.xlsx with one row per selected journal: Journal ID, score, the criteria it met, and blank columns for Support Obtained, Business Rationale, Approval Evidenced, Tickmark, Exception (Y/N) and Tester. Do not mark any journal as tested or cleared.
Record the reason for each selection in the working paper.
How to check the result
- Control totals. Total debits should equal total credits for the whole file before you look at any account. Tie the row count and totals to figures from the ledger, and explain every non-zero roll-forward difference with evidence.
- Read the rules against your design.
Read je_scoring.py and JE_Criteria_Q4.xlsx. Do not open any data file. For each criterion, show the script lines that implement it and explain in plain English exactly what they compare, including every threshold. Then write made-up test rows that sit exactly on each threshold, with the result each should give, and save them as Edge_Cases.csv.
A script can be precisely and consistently wrong, for example applying "whichever is higher" where the design says "whichever is lower". Every flagged item would still look right; the error is in the ones never flagged. Run the edge cases through the script after every change.
- Recompute by hand. Pick a few scored journals, including an awkward one, and confirm each Y/N flag from the source lines.
- Check low scorers too. Look at some entries that scored low, to confirm the criteria are not missing something.
- Check timestamps. Created timestamps may be in server time, not local time. Confirm before relying on the after-hours flag.
- Ask for assumptions. "List every assumption you made and everything you did not check" surfaces choices about periods, sources and sign conventions that a script makes silently.
File the criteria workbook, scripts, prompts, outputs and hand checks together, so a reviewer can re-run the test.
Limits
- A score ranks entries; it is not a measure of risk you can quote. Write "selected using these criteria" in the working paper, not "high-risk journals", and never present a score as a finding.
- The roll-forward proves the extract agrees with the trial balances. How the trial balances and extract were produced still needs its own evidence.
- Journal descriptions can hold sensitive information, such as pending deals. Leave free-text fields out of the extract unless a test needs them.
- Work from read-only extracts. Do not let any tool post or reverse journals in a live system.
- Whether an unusual entry is an exception, and how serious, is your evaluation, not the script's.
From the book
This guide is a short version of one method in AI for Internal Auditors. Chapter 8 of AI for Internal Auditors walks through it end to end on practice files with an answer key.
More free guides
- Free guide · AI for Internal Auditors
Duplicate Payment Testing with AI: Full AP Population
Test every AP invoice for duplicate payments and three-way match exceptions with AI, without uploading the ledger. Prompts, checks and limits.
Read the guide → - Free guide · AI for Internal Auditors
Segregation of Duties Analysis with AI: User Access Review
Find SoD conflicts, mitigated cases and leavers with active accounts across a full ERP access listing using AI, with user data kept on your laptop.
Read the guide →