AI for Spend Analysis by Vendor and Category: A Worked Example From AP Export to Savings Shortlist
How a finance team turns a year of messy AP data into spend by vendor and category, a short list of savings to pursue and a quarterly review, with the prompts that do each step.

Most mid-size companies cannot say what they spent last year on packaging, forklift repairs or software, because the answer is spread across hundreds of vendor names, a dozen GL accounts and memo fields nobody standardized. AI is good at the dull part of fixing that: cleaning vendor names, assigning each line to a category and building the summary. The decisions about which contracts to rebid, which vendors to drop and which savings are real stay with finance and purchasing.
This example follows a 140-person food distributor with two entities. The controller wants one view of a year of non-inventory spend before budget season. All figures are example data.
Before you start
Use an approved tool. Work in a business plan your company has approved, or the AI built into your ERP or spend tool. An AP export shows who you pay and how much, which is commercially sensitive.
Take out people. Employee expense reimbursements and payments to individual contractors often sit in the AP vendor list. Filter them out of the export, or replace the name with the vendor ID, before the file goes anywhere.
Know your control total. Write down the total of the export and the GL total it should agree to. Every step below must still add up to that number.
The data: what the AP export looks like
Export 12 months of paid AP lines from your accounting system with vendor ID, vendor name, entity, GL account, memo or line description, invoice date and amount. Leave out inventory purchases if you analyze those separately. Here are eight lines from the distributor's export, as they came out of the system:
| Vendor (as entered) | GL account | Memo | Amount |
|---|---|---|---|
| ULINE INC | 6200 Supplies | stretch wrap, pallet labels | $4,812.40 |
| Uline | 5100 COGS – Packaging | boxes 18x12x10 | $11,260.00 |
| AMZN Mktp US | 6200 Supplies | toner, label printer ribbons | $1,394.17 |
| Amazon Business | 6400 Repairs & Maint | dock door seal kit | $2,108.55 |
| Cintas Corp #431 | 6300 Facilities | uniforms + mats, Oct | $3,145.00 |
| CINTAS | 6300 Facilities | first aid restock | $486.20 |
| Pinnacle Forklift Svc | 6400 Repairs & Maint | PM service, 4 trucks | $2,960.00 |
| Pinnacle Forklift Service LLC | 6400 Repairs & Maint | hydraulic repair truck 7 | $4,415.80 |
Three problems show up in just eight lines. The same supplier appears under two or three names. The same kind of purchase is coded to different GL accounts. And one vendor, Amazon, sells the company several unrelated things, so the vendor name alone does not tell you the category.
Step 1: Clean the vendor names
What to check. Read every medium and low confidence grouping. A franchise location, a parent company and its subsidiary, or two unrelated firms with similar names are the usual mistakes. If the same supplier has two vendor IDs in your system, add it to your vendor master clean-up list, because it is also a duplicate-payment risk.
Step 2: Assign a category to every line
Give the AI your own category list rather than letting it invent one. A short, two-level list that purchasing recognizes is better than a long one. The distributor used seven top-level categories with a few subcategories each.
Here are the same eight lines afterwards:
| Parent vendor | Category | Subcategory | Amount | Coding note |
|---|---|---|---|---|
| Uline | Packaging and shipping supplies | Stretch wrap and labels | $4,812.40 | Packaging coded to 6200 here and to 5100 below |
| Uline | Packaging and shipping supplies | Cartons | $11,260.00 | |
| Amazon | Office and IT supplies | Printer consumables | $1,394.17 | |
| Amazon | Warehouse equipment maintenance | Dock equipment parts | $2,108.55 | |
| Cintas | Facilities services | Uniforms and mats | $3,145.00 | |
| Cintas | Facilities services | Safety supplies | $486.20 | |
| Pinnacle Forklift | Warehouse equipment maintenance | Forklift preventive maintenance | $2,960.00 | |
| Pinnacle Forklift | Warehouse equipment maintenance | Forklift repairs | $4,415.80 |
What to check. Sort by amount and review the 50 largest lines by hand, then sample 20 lines marked "Inferred". Those two checks usually cover most of the spend. Send the coding notes to whoever owns the chart of accounts; they are a by-product worth having, not something the AI should fix on its own.
Step 3: Build the summary by category and vendor
The distributor's summary for the year:
| Category | Vendors | Annual spend | Largest vendor's share |
|---|---|---|---|
| Freight, outbound | 7 | $1,138,000 | 39% |
| Packaging and shipping supplies | 9 | $612,400 | 71% |
| Temporary labor | 3 | $418,000 | 62% |
| Warehouse equipment maintenance | 6 | $284,900 | 48% |
| Software subscriptions | 23 | $241,800 | 22% |
| Facilities services | 11 | $203,600 | 35% |
| Office and IT supplies | 14 | $96,300 | 41% |
| Total | 73 | $2,995,000 |
Tie the total to the control total you wrote down at the start before anyone reads the analysis.
Step 4: Draft the savings shortlist
The summary shows where to look. Ask the AI to list candidates and explain why, but not to estimate savings it cannot know.
For the distributor, the shortlist included packaging (one supplier at 71% of $612,400 with no contract on file, so a good candidate for a volume agreement or a competitive quote), software (23 vendors, including three that looked like overlapping scheduling tools), office and IT supplies (14 vendors for $96,300, much of it on Amazon with no purchasing account set up) and forklift maintenance (repairs on two trucks running higher than preventive maintenance on the whole fleet, which is a repair-or-replace question for operations, not a price question).
What to check. Every item needs an owner who knows the context. The packaging supplier may already give the best price in the region; the "overlapping" software may serve different sites. Finance brings the numbers, purchasing and the budget owners decide.
Step 5: Make it a quarterly routine
- Export the new quarter. Use the same columns and filters as the first run, and write down the control total.
- Reuse the vendor map and categories. Ask the AI to apply last quarter's parent vendor table and category list, and to list only new vendors and new memo patterns for review.
- Compare with the prior quarter. Ask for categories and vendors whose spend moved by more than a set amount, such as $10,000 or 20%, with the invoices behind the change.
- Update the shortlist. Mark each item as open, in progress or closed, with the owner's note.
- Bring one page to the leadership meeting. The category table, the movers and the shortlist status are enough.
Where this breaks
Thin memos. If invoice lines say only "Services" or "Per invoice", the category is a guess based on the vendor. Fixing line descriptions at invoice entry does more for spend analysis than any prompt.
Wrong groupings. Merging two different companies, or splitting one, moves spend between vendors and can make a concentration look larger or smaller than it is. Review every grouping the first time.
Totals that drift. AI can drop rows, double-count a split line or round in a way that changes the total. Ask for formulas, and tie every summary back to the export and the GL.
Spend outside AP. Corporate cards, expense reports and direct debits do not appear in an AP export. If a large share of a category runs through cards, add that data or say clearly that the view excludes it.
Savings that are not savings. A lower price can come with longer lead times, worse service or a minimum volume. The analysis finds questions to ask; it does not answer them.
How to start this month
Pick one entity and one year of non-inventory AP spend. Run steps 1 to 3, tie the total, and review the vendor groupings and the 50 largest lines. If the result holds up, add the second entity and take the shortlist to purchasing before budget meetings start. Our guides to AI in procurement and purchasing and AI for accounts payable cover the steps on either side of this one.
Free buyer's guide
The Spend Management Buyer's Guide
How to evaluate modern tools that automate procure-to-pay, corporate cards and vendor payments.
Related Articles