✏️Prompts

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.

Supplier invoices being sorted into categorized folders beside a laptop showing a spend chart

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

Check these first

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 accountMemoAmount
ULINE INC6200 Suppliesstretch wrap, pallet labels$4,812.40
Uline5100 COGS – Packagingboxes 18x12x10$11,260.00
AMZN Mktp US6200 Suppliestoner, label printer ribbons$1,394.17
Amazon Business6400 Repairs & Maintdock door seal kit$2,108.55
Cintas Corp #4316300 Facilitiesuniforms + mats, Oct$3,145.00
CINTAS6300 Facilitiesfirst aid restock$486.20
Pinnacle Forklift Svc6400 Repairs & MaintPM service, 4 trucks$2,960.00
Pinnacle Forklift Service LLC6400 Repairs & Mainthydraulic 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

Prompt
The attached file is 12 months of paid AP lines. Add a column called "Parent vendor" that groups vendor names referring to the same company, for example "ULINE INC" and "Uline". Use the vendor ID, name and memo to decide. Do not group companies that only share a word in their name. Then give me a separate table of every grouping you made, with the original names, the parent vendor name and your confidence (high, medium or low). Do not change or delete any original column, and confirm that the total of the Amount column is unchanged.

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.

Prompt
Using the "Categories" tab, which lists our spend categories and subcategories with a one-line definition of each, add two columns to the AP data: "Category" and "Subcategory". Assign each line based on the memo first and the vendor second, because some vendors sell us several kinds of things. If the memo is blank or unclear, use the vendor's most common category in the rest of the data and mark the line "Inferred". If no category fits, use "Unassigned". Add a "Coding note" column wherever the GL account looks inconsistent with the category, for example packaging coded to Supplies in one month and to COGS in another. Do not change the GL coding itself.

Here are the same eight lines afterwards:

Parent vendorCategorySubcategoryAmountCoding note
UlinePackaging and shipping suppliesStretch wrap and labels$4,812.40Packaging coded to 6200 here and to 5100 below
UlinePackaging and shipping suppliesCartons$11,260.00
AmazonOffice and IT suppliesPrinter consumables$1,394.17
AmazonWarehouse equipment maintenanceDock equipment parts$2,108.55
CintasFacilities servicesUniforms and mats$3,145.00
CintasFacilities servicesSafety supplies$486.20
Pinnacle ForkliftWarehouse equipment maintenanceForklift preventive maintenance$2,960.00
Pinnacle ForkliftWarehouse equipment maintenanceForklift 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

Prompt
Build a summary on a new tab using formulas or a pivot table, not typed values. For each category show: number of parent vendors, total spend, share of total spend, the largest vendor and that vendor's share of the category. Add a total row and show that it equals the total of the AP data. Then add a second table listing every parent vendor with spend over $25,000, its category, spend by quarter, and the number of invoices.

The distributor's summary for the year:

CategoryVendorsAnnual spendLargest vendor's share
Freight, outbound7$1,138,00039%
Packaging and shipping supplies9$612,40071%
Temporary labor3$418,00062%
Warehouse equipment maintenance6$284,90048%
Software subscriptions23$241,80022%
Facilities services11$203,60035%
Office and IT supplies14$96,30041%
Total73$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.

Prompt
Using the summary and vendor tables, list up to eight places to review for savings. Look for: categories with many vendors for similar purchases, categories where one vendor has most of the spend and there is no contract on our "Contracts" tab, the same item bought from several vendors, software vendors whose products appear to overlap, and vendors whose quarterly spend rose more than 20% without a matching rise in invoice count. For each, give the category, the vendors involved, the annual spend affected and one sentence on why it is worth a look. Do not estimate a savings amount, and do not recommend dropping any vendor.

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

  1. Export the new quarter. Use the same columns and filters as the first run, and write down the control total.
  2. 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.
  3. 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.
  4. Update the shortlist. Mark each item as open, in progress or closed, with the owner's note.
  5. Bring one page to the leadership meeting. The category table, the movers and the shortlist status are enough.
Prompt
Attached are this quarter's AP lines, last quarter's "Parent vendor" table and our "Categories" tab. Apply the existing vendor groupings and categories to the new lines. List separately any vendor not in last quarter's table and any line you could not categorize, so I can review them before you go further. Then compare spend by category and by parent vendor with last quarter and list every change over $10,000 or 20%, with the five largest invoices behind each. Confirm the total ties to the export total.

Where this breaks

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