Lesson 2: Clean and map a messy GL export with AI

Published by

on

The Pragmatic CFO: practical finance for the AI era

TL;DR A raw GL export is the first thing most finance teams hand to AI, and the first place AI quietly gets things wrong. In this lesson you have an assistant clean location labels, map 21 raw accounts to 11 standard P&L lines, reclass a suspense item from a memo, and build a September P&L by branch that ties to the export to the dollar.

What you’ll practice

  • Making an assistant propose a mapping for you to approve, instead of applying one it made up.
  • Handling the three things that break most GL cleanups: label variants, sign conventions and suspense.
  • Proving the result with a tie-out that catches dropped rows, and a line check that catches wrong mappings.

Time: about 30 minutes. You need the sample workbook (download the free sample workbook (Excel)) and any AI assistant that can read an uploaded spreadsheet. Larkspur Supply Co. is a made-up company, so the file is safe to upload anywhere. If you skipped lesson 1, read its five-line prompt section first; every prompt below uses it.

The mess in this export

Sheet 1_GL_Export holds 85 rows of September 2026 P&L activity in five columns: Account, Account Description, Location, Debit, Credit. It looks like what comes out of a real ledger after someone has posted to it for a few years. Here is what is wrong with it:

  • Seven location labels for four branches. “North” and “NORTH,” “South” and “South Branch,” “West” and “WEST BR,” plus “East.”
  • Two account codes with two descriptions each. Code 6000 appears as “Salaries & Wages” and “Salaries and wages.” Code 6300 appears as “Fuel” and “FUEL - TRUCKS.” Same account, different text.
  • No mapping provided. Sheet 1b_Chart_Map lists the 11 standard lines but does not say which raw account goes where. The assistant has to propose it, and you have to approve it.
  • Revenue as credits, returns as debits. Sales sit in the Credit column. Code 4090, Sales Returns & Allow., sits in the Debit column and reduces revenue.
  • A suspense posting. Code 9999, $4,200 in North, described “SUSPENSE - see memo FRT-0917.” The memo at the bottom of 1b_Chart_Map says it is North freight out, parked in suspense because the purchase order was missing.

Know your proof before you start

Set the target before the assistant does any work. Revenue is in credits and costs are in debits, so for each branch, debits minus credits equals minus EBITDA. That gives you a tie-out the assistant cannot argue with:

BranchDebits minus credits (export)EBITDA your P&L must show
North-122,000122,000
South-62,90062,900
East-92,00092,000
West-24,80024,800
Total-301,700301,700

Export totals: debits 4,847,583, credits 5,149,283. If your lesson 1 inventory matched these, you are ready.

The exercise

Run it in two prompts, not one. The first proposes; you review; the second applies. Splitting it puts your judgment between the assistant’s guess and the final numbers.

  1. Upload the workbook to a new chat.
  2. Run prompt 1. Read the mapping table it returns, row by row.
  3. Correct anything you disagree with in plain words (“6030 OT premium goes to Branch payroll”), then run prompt 2.
  4. Check the proof table first. If any branch is off, do not read the P&L yet. Ask which rows explain the difference.
  5. Compare the P&L to the answer key below.

Prompt 1: normalize and propose a mapping

JOB: You are a staff accountant at a four-branch industrial supply distributor. Your task is to clean the September GL export and propose an account mapping for my review. Do not build the P&L yet.
DATA: Attached workbook, sheet 1_GL_Export (85 rows: Account, Account Description, Location, Debit, Credit; blanks mean zero; US dollars). Standard lines and a memo are in sheet 1b_Chart_Map.
RULES: There are exactly four branches: North, South, East, West. Map every location label to one of them and show the rule. Treat the account code as the key; a code with two descriptions is one account. Map each code to exactly one of the 11 standard lines. Do not map code 9999 to a line unless a memo in the workbook supports it, and quote the memo if it does. Do not create new lines.
OUTPUT: Table 1: Raw location label, Branch, Row count. Table 2: Account code, Description(s) as they appear, Proposed standard line, Reason (one short phrase), Confidence (high/medium/low).
PROOF: Show that Table 1 row counts add to 85. Confirm every code in the export appears once in Table 2. List any code you could not map with confidence and why.

Prompt 2: reclass, build the P&L, tie it out

JOB: Same role. Apply the approved mapping and build the September P&L by branch.
DATA: Same sheet 1_GL_Export, your Table 1 and Table 2 with my corrections: [paste your corrections, or "approved as proposed"].
RULES: Reclass the 9999 suspense row to North, Freight out, per memo FRT-0917, and show it as its own line in the proof. Revenue lines are credits minus debits, so Sales Returns & Allow. (4090) reduces revenue. Cost lines are debits minus credits. Do not round. Do not drop any row.
OUTPUT: P&L table: rows are the 11 standard lines plus EBITDA (Revenue minus all other lines); columns North, South, East, West, Total. Whole dollars.
PROOF: Proof table with columns: Branch, Debits minus credits from the export, EBITDA from your P&L, Difference. Every difference must be zero. Also show North Freight out as the 5200 amount plus the 4,200 reclass. List anything you assumed.

What a good answer looks like

Prompt 1 should find seven raw labels mapping to four branches (North 22 rows, South 21, East 21, West 21), and 22 codes: 21 real accounts plus suspense 9999, with 9999 mapped to Freight out only by quoting the memo. Prompt 2 should tie every branch to zero difference.

Show the answer key

Location labels

Raw labelBranchRows
NorthNorth11
NORTHNorth11
SouthSouth16
South BranchSouth5
EastEast21
WestWest12
WEST BRWest9
Total85

Account mapping

CodeDescription(s)Standard line
4000SALES - PRODUCTRevenue
4010Sales-ServiceRevenue
4090Sales Returns & Allow.Revenue (reduces it)
5000COGS ProductCost of goods sold
5010Inventory adj / shrinkCost of goods sold
5200Freight OutFreight out
6000Salaries & Wages; Salaries and wagesBranch payroll
6010Payroll taxesBranch payroll
6020Benefits - MedicalBranch payroll
6030OT premiumBranch payroll
6100RentRent and occupancy
6110CAM / Property taxRent and occupancy
6200UtilitiesUtilities
6300Fuel; FUEL - TRUCKSVehicle and fuel
6310Vehicle repairs & maintVehicle and fuel
6400AdvertisingMarketing
6500Software subscriptionsSoftware and IT
6600Bad Debt ExpBad debt expense
6900Misc expenseOther operating expense
6910Bank feesOther operating expense
6920Office suppliesOther operating expense
9999SUSPENSE - see memo FRT-0917Freight out, North (reclass per memo)

September 2026 P&L by branch

LineNorthSouthEastWestTotal
Revenue1,478,3001,196,4001,338,9001,084,7005,098,300
Cost of goods sold1,036,200840,100940,500768,9003,585,700
Freight out36,90030,60046,80027,400141,700
Branch payroll184,600176,900166,200157,300685,000
Rent and occupancy42,00036,00039,00038,000155,000
Utilities9,4008,9009,7008,60036,600
Vehicle and fuel21,70019,10020,30018,10079,200
Marketing7,2006,7007,1007,60028,600
Software and IT6,5005,5006,0005,80023,800
Bad debt expense3,9003,3004,10021,90033,200
Other operating expense7,9006,4007,2006,30027,800
EBITDA122,00062,90092,00024,800301,700

Proof: every branch difference is zero. North Freight out is 32,700 in code 5200 plus the 4,200 reclass, 36,900. Revenue is 5,149,283 of credits less 50,983 of returns, 5,098,300. The P&L also matches the Sep actual column in sheet 2_Budget_vs_Actual line for line, which you will use in lesson 3.

Where AI goes wrong on this task

Our view of the failures to watch for, and how the proof catches each one:

  • Dropping the suspense row. An assistant that ignores 9999 because it does not fit a standard line shows North Freight out of 32,700 and North EBITDA of 126,200. The proof table shows a 4,200 difference in North. This is why the prompt says “do not drop any row.”
  • Getting the returns sign wrong. Treating the 50,983 of returns as more sales instead of less overstates revenue by 101,966, twice the returns. Revenue would show 5,200,266. Again, the proof breaks.
  • Splitting or merging the wrong things. Treating “Salaries and wages” as a different account from “Salaries & Wages” can leave East’s 129,636 unmapped. The opposite mistake is merging by description and pushing 6030 OT premium somewhere other than payroll. Keying on the account code, as the prompt requires, prevents both.
  • Inventing a mapping for 9999. This is the dangerous one. If the assistant decides suspense “looks like” Other operating expense, every branch still ties, because the 4,200 is still in North. The total proof cannot see a wrong line, only a missing amount. Only the line check catches it: North Freight out must be 36,900, and the mapping must quote memo FRT-0917.
  • Grouping by raw label. A P&L with seven columns, or one where “NORTH” quietly disappears, means step one was skipped.

What stays with a person

Approving the mapping. Where an account lands on the P&L is a policy decision that affects every report after this one, so the assistant proposes and you decide. The same goes for the suspense reclass: the assistant can read the memo, but the actual journal entry in your ledger needs its support (here, the missing purchase order) and your approval. And only you know whether the export itself is complete: right period, right entity, nothing posted after you pulled it.

Check yourself

Why run this as two prompts instead of one?

The first prompt only proposes a mapping. You review it before any numbers are built, so a wrong guess gets fixed while it is still one row in a table, not buried inside a finished P&L.

The export’s debits minus credits is -301,700. Why negative, and what should EBITDA be?

Revenue is recorded as credits, so a profitable month has more credits than debits. Debits minus credits is minus EBITDA, so EBITDA is 301,700.

The assistant maps 9999 to Other operating expense, and every branch still ties. Is the P&L right?

No. The total is right but the line is wrong: North Freight out shows 32,700 instead of 36,900 and Other operating expense is overstated by 4,200. A tie-out proves nothing was lost, not that everything is in the right place. Memo FRT-0917 says it is North freight out.

Why key the mapping on account code rather than description?

Descriptions drift. Code 6000 appears with two descriptions and code 6300 with two. The code is the stable key; mapping by text risks splitting one account into two or merging different accounts with similar names.

Revenue comes back as 5,200,266. What happened?

The 50,983 of sales returns (code 4090) was added to revenue instead of subtracted, which overstates revenue by twice the returns, 101,966. Correct revenue is 5,098,300.

Your turn: try it on your own numbers

Take last month’s GL detail for one entity and run both prompts on it, with your real chart of accounts in place of 1b_Chart_Map. Keep the proof line exactly as written: you already know your own EBITDA, so a wrong tie-out shows up immediately. Do this only in an assistant on a business or enterprise plan your company has approved, and remove payroll detail at the employee level before you upload. If you are unsure what can go where, go back to lesson 1.

Next: Lesson 3: Write branch variance commentary with AI (that a CFO would sign)

New here? Start here to find the best guide for your job, or use the free finance templates, the CFO metrics library and the CFO moves tracker.