Duplicate vendor payments in Excel with Copilot or Claude: 4 AP tests

Duplicate vendor payments are found in Excel with four tests run on the accounts payable invoice register: an exact match on vendor, invoice number and amount; a match on a normalized invoice number that ignores spaces, hyphens and leading zeros; a cross-vendor match that catches the same invoice entered under two vendor master records; and a near match on vendor and amount within a short date window. Copilot in Excel and Claude for Excel can both build the helper columns and COUNTIFS flags for these tests from a plain-language prompt, and each test can be checked against a result computed independently.
The four tests catch different failure modes. Exact matches are rare in a system that blocks a repeated invoice number, so most duplicates that reach payment differ in formatting: "INV-10452" against "INV 10452", or "7781" against "0007781". Others come from a vendor that exists twice in the master file, often after an acquisition, a name change or a remittance-address update, which defeats any check that runs within a single vendor ID.
In the illustrative 12-line register used below, totaling $60,406.75, the four tests flag 10 lines. Three pairs are confirmed duplicates that were paid twice, worth $13,735.50; one duplicate of $12,400.00 is still open and can be blocked before the payment run; and one pair of $980.00 needs a reviewer's judgement. Every figure in the example was computed in Python so the reader can compare it with what the AI returns.
··········
WHY AP TEAMS RUN DUPLICATE INVOICE AND PAYMENT TESTS.
A duplicate payment usually starts as a duplicate invoice. The same document arrives twice, by email and by post, or once as a PDF and again as a statement reminder, and two people enter it a few days apart. If the invoice numbers are typed differently, the ERP's own duplicate check sees two distinct documents and both go to approval. Approvers see a familiar vendor and a familiar amount, and both are released.
The cost is cash out of the business until the vendor refunds it or offsets it against a later invoice, and vendors do not always notice. Recovery also gets harder with time: a vendor credit balance that sits for a year may be written back on the vendor's side, and the paying company's own records may by then show the duplicate expensed and closed.
Controllers run these tests at three points: before each payment run on open invoices, monthly on the paid population as a detective control, and once on a full year of history when a new AP system is implemented or when auditors ask how the control is evidenced. The same logic works in all three, and only the population changes. A related monthly control, matching the ledger to what each vendor says it is owed, is covered in our guide to vendor statement reconciliation in Excel with Copilot and Claude.
··········
COPILOT IN EXCEL AND CLAUDE FOR EXCEL: DOCUMENTED REQUIREMENTS.
Both assistants run inside Excel and can write formulas, add helper columns and apply conditional formatting to an AP export. Their access rules and data handling differ, and the table summarizes what the vendors' documentation states, as verified on November 27, 2026.
........
Item | Copilot in Excel | Claude for Excel |
Who can use it | M365 Personal or Family with AI credits, M365 Premium, commercial Copilot, or Copilot Chat-eligible business plans | Pro, Max, Team and Enterprise plans |
Platforms | Edit, plan and chat on Windows, Mac and web | Excel on the web, Windows (M365 build 16.0.13127.20296+), Mac 16.46+ |
Not supported | Strict Open XML files; editing needs Automatic calculation | Excel 2016 and 2019, iPad, Android; data tables, macros and VBA |
Models | Claude or GPT models; switcher needs commercial Copilot or M365 Premium | Claude |
Data handling | Prompts and responses not used to train foundation models | Backend deletion within 30 days; no custom retention inheritance |
........
Copilot in Excel offers three modes. Plan mode proposes the steps before it changes the workbook, which suits an audit-style task where the reviewer wants to approve the approach first. Microsoft's FAQ states that Copilot editing works only when Calculation Options are set to Automatic, and that files checked out in a SharePoint library return an unsupported file state on Windows and Mac. In enterprise tenants, an administrator has to enable Anthropic as a Microsoft sub-processor before Claude models can be selected inside Copilot.
Anthropic's documentation describes Claude for Excel as working across multi-tab workbooks and performing native operations such as sorting, filtering, pivot tables, conditional formatting and data validation. It recommends against using it for audit-critical calculations without verification, and asks users to work only with trusted spreadsheets because content in a file can attempt to steer the assistant. Activity is not included in Enterprise audit logs unless the Compliance API is enabled.
Excel's built-in tools have a limit that shapes the method. Microsoft's support article on unique values states that duplicates are compared on what appears in the cell, not on the underlying value, and that Remove Duplicates permanently deletes the rows it finds. For an AP test the register should never be de-duplicated in place: the goal is to flag pairs for review, keep the evidence, and leave the source export unchanged.
··········
ILLUSTRATIVE AP INVOICE REGISTER FOR THE DUPLICATE TESTS.
The register below is illustrative. It mimics an export from an accounting system with one row per invoice, columns A to G, and a header in row 1. Invoice dates are in column E and amounts in column F.
........
ID | Vendor ID | Vendor | Invoice no. | Invoice date | Amount | Status |
1 | V100 | Apex Supply | INV-10452 | 2026-10-02 | 4,860.00 | Paid |
2 | V100 | Apex Supply | INV-10452 | 2026-10-02 | 4,860.00 | Paid |
3 | V205 | Northline Logistics | 7781 | 2026-10-05 | 12,400.00 | Paid |
4 | V205 | Northline Logistics | 0007781 | 2026-10-05 | 12,400.00 | Open |
5 | V310 | Brightway IT | BW-2291 | 2026-10-08 | 2,150.00 | Paid |
6 | V310 | Brightway IT | BW 2291 | 2026-10-09 | 2,150.00 | Paid |
7 | V420 | Cedar Facilities | CF-5512 | 2026-10-12 | 980.00 | Paid |
8 | V420 | Cedar Facilities | CF-5518 | 2026-10-15 | 980.00 | Paid |
9 | V512 | Delta Packaging | DP-3307 | 2026-10-14 | 6,725.50 | Paid |
10 | V587 | Delta Packaging Inc | DP-3307 | 2026-10-14 | 6,725.50 | Paid |
11 | V100 | Apex Supply | INV-10498 | 2026-10-20 | 4,860.00 | Paid |
12 | V640 | Evergreen Utilities | EU-8841 | 2026-10-22 | 1,315.75 | Paid |
........
The data was built so that each test has something to find, plus one decoy. Row 11 is a second Apex Supply invoice for the same $4,860.00 as rows 1 and 2, but with a different number and an invoice date 18 days later, which is the pattern of a legitimate recurring charge. A good test design leaves it unflagged.
··········
PROMPTS FOR COPILOT OR CLAUDE TO BUILD THE FOUR DUPLICATE TESTS.
The prompts work best when they name the columns, define each test precisely and ask for formulas instead of a one-off answer, so that the logic stays visible in the workbook. A first prompt builds the normalized key.
The AP invoice register is in A1:G13 with headers in row 1.
Add a helper column H called "Inv key" that converts the invoice
number in column D to upper case, removes spaces and hyphens, and
removes leading zeros when the result is purely numeric.
Use a formula, not typed values, and fill it down to row 13.A formula that produces this key in Microsoft 365 Excel uses functions documented by Microsoft, and it is the kind of output to expect from either assistant.
=LET(k, UPPER(SUBSTITUTE(SUBSTITUTE(TRIM(D2)," ",""),"-","")),
IFERROR(TEXT(VALUE(k),"0"), k))The second prompt adds the four flags.
Add four TRUE/FALSE columns using COUNTIFS on whole rows 2:13:
I "Exact": same Vendor ID, same invoice number in D, same Amount,
appearing more than once.
J "Normalized": same Vendor ID, same Inv key, same Amount, more than once.
K "Cross-vendor": same Inv key and Amount appear more often across all
vendors than within this Vendor ID.
L "Near match": same Vendor ID and Amount with an invoice date within
7 days, where at least one such row has a different Inv key.
Then highlight any row where I, J, K or L is TRUE. Do not delete rows.Formulas that implement the four flags for row 2 look like this, filled down to row 13.
I2: =COUNTIFS($B$2:$B$13,B2,$D$2:$D$13,D2,$F$2:$F$13,F2)>1
J2: =COUNTIFS($B$2:$B$13,B2,$H$2:$H$13,H2,$F$2:$F$13,F2)>1
K2: =COUNTIFS($H$2:$H$13,H2,$F$2:$F$13,F2)
>COUNTIFS($B$2:$B$13,B2,$H$2:$H$13,H2,$F$2:$F$13,F2)
L2: =COUNTIFS($B$2:$B$13,B2,$F$2:$F$13,F2,$E$2:$E$13,">="&E2-7,$E$2:$E$13,"<="&E2+7)
-COUNTIFS($B$2:$B$13,B2,$F$2:$F$13,F2,$H$2:$H$13,H2,$E$2:$E$13,">="&E2-7,$E$2:$E$13,"<="&E2+7)>0The near-match flag subtracts the rows that already share the key, so a pair caught by the normalized test is not counted twice. A third prompt asks for a summary on a new sheet: each flagged pair, its test, the amount, the payment status of both lines and a proposed action. Asking the assistant to explain each formula in its reply gives the reviewer a written description of the logic for the control file.
··········
EXPECTED RESULT OF THE DUPLICATE PAYMENT TESTS.
The correct output for the illustrative register, computed independently in Python with the same rules, is shown below. An assistant's result that differs from it points to an error in a formula, a range or a date format.
........
Test | Rows flagged | Amount per line | Status of pair | Action |
Exact | 1 and 2 | 4,860.00 | Both paid | Recover 4,860.00 |
Normalized | 1-2, 3-4, 5-6 | See rows | 3 paid, 4 open | Block row 4; recover row 6 |
Cross-vendor | 9 and 10 | 6,725.50 | Both paid | Recover; merge V587 into V512 |
Near match | 7 and 8 | 980.00 | Both paid | Request both invoices |
None | 11 and 12 | n/a | n/a | No action |
........
The normalized test also flags rows 1 and 2, since a key match includes every exact match. Row 6 differs from row 5 by one day in invoice date, a common sign of a re-keyed document, and it is still caught because the normalized test does not look at dates. Row 11 is not flagged by any test: its key differs from rows 1 and 2, and its date sits outside the 7-day window.
The totals give the reviewer a quick reconciliation. Confirmed duplicates already paid come to $13,735.50 (4,860.00 + 2,150.00 + 6,725.50), which is 22.74% of the $60,406.75 register, a proportion inflated by design for the example. The open duplicate is $12,400.00, and the near match under review is $980.00. Ten of twelve rows carry at least one flag.
Once the vendor has confirmed each paid duplicate, the corrections follow a standard pattern. The entries below assume each duplicate invoice was originally posted to an operating expense account.
........
Entry | Account | Debit | Credit |
Reverse paid duplicates | Accounts payable (V100, V310, V587) | 13,735.50 | |
Reverse paid duplicates | Operating expense | 13,735.50 | |
Reclassify vendor debit balances | Other receivables: vendor overpayments | 13,735.50 | |
Reclassify vendor debit balances | Accounts payable (V100, V310, V587) | 13,735.50 | |
Void open duplicate (row 4) | Accounts payable (V205) | 12,400.00 | |
Void open duplicate (row 4) | Operating expense | 12,400.00 | |
Total | 39,871.00 | 39,871.00 |
........
When the refund arrives, cash is debited and the receivable credited; when the vendor offsets the overpayment against a later invoice, the receivable is cleared against accounts payable instead. Teams that post invoices to inventory or a capital project replace the expense line with that account.
··········
REVIEW CONTROLS FOR AI-BUILT DUPLICATE INVOICE CHECKS.
The errors that appear most often in AI-built duplicate tests are mechanical, and each has a quick check.
Ranges that stop short. A formula written for rows 2 to 13 in a test file will miss the last lines of a real export with thousands of rows. Converting the register into an Excel table, or checking that every COUNTIFS range ends on the last data row, closes the gap. A count of flagged rows that does not change when a known duplicate is pasted at the bottom is a sign of a short range.
Amounts and dates stored as text. A system export often brings amounts with thousands separators or trailing spaces stored as text, and dates as text strings. COUNTIFS then compares text with numbers and misses matches, and the date-window criteria fail silently. ISNUMBER on the amount and date columns should return TRUE for every row before the tests run.
Over-aggressive normalization. Removing every non-numeric character can merge invoices that are different documents, such as "CR-2291" for a credit memo and "BW-2291" for an invoice. Keeping the letters in the key, as the formula above does, avoids that; credit memos should also be separated by document type before testing, since a credit and an invoice for the same amount are not duplicates.
Thresholds chosen by the assistant. A 7-day window and an exact amount match are design choices, and an assistant may propose a 30-day window or an amount tolerance without saying so. The reviewer should fix the parameters in the prompt and record them with the results, since a near-match test with a wide window on a vendor with weekly recurring charges produces mostly false positives.
Conclusions the data cannot support. The near match on Cedar Facilities could be two genuine service visits at the same price. The assistant can flag the pair, and only the invoices themselves, or the vendor, can settle it. Decisions to block a payment, request a refund, or merge vendor master records stay with AP and the controller, with the supporting documents attached. The AP aging report is the natural place to monitor vendor debit balances created by the corrections; our explainer on accounts payable aging and supplier payments covers how those balances are read.
Cleaning the export before testing follows the same discipline as any data preparation: count the rows going in and coming out, and never let a cleaning step silently drop records. Our guide on how to clean and deduplicate a CSV with ChatGPT and verify the counts shows that row-count check step by step.
··········
DATA PRIVACY FOR VENDOR AND PAYMENT DATA.
An AP register contains vendor names, invoice references and amounts, and sometimes bank details or tax identification numbers. Removing columns the tests do not need, such as bank account numbers and remittance addresses, reduces exposure before any assistant reads the file.
Microsoft states that prompts, responses and data accessed through Microsoft Graph are not used to train foundation large language models. Its privacy documentation, last updated November 3, 2026, also notes that models provided by Anthropic as a sub-processor are currently excluded from the EU Data Boundary, a point relevant to European entities that choose Claude models inside Copilot.
Anthropic's documentation for Claude for Excel states that inputs and outputs are deleted on the backend within 30 days of receipt or generation, with listed exceptions, and that the add-in does not inherit custom data retention settings an organization has configured. Chat history is stored locally in the browser and clearing it does not delete data held by Anthropic.
··········
DUPLICATE VENDOR PAYMENT TESTS IN EXCEL: CONCLUSIONS FOR AP TEAMS.
Four tests on vendor, normalized invoice number, amount and date catch the duplicate patterns that slip past an ERP's own invoice-number check, and they can be built with COUNTIFS and one helper column in Microsoft 365 Excel. Copilot in Excel and Claude for Excel can write those formulas and the summary from a precise prompt, under the plan, platform and data-handling terms set out in each vendor's documentation as of November 27, 2026.
The reliability of the result depends on choices the reviewer controls: the normalization rule, the date window, the treatment of credit memos and the completeness of the ranges. Recomputing a small sample with known answers, as in the illustrative register here, is the fastest way to confirm that the assistant's formulas behave as intended before they run on a full year of payments.
Vendor-level judgements remain outside the formulas. Near matches need documents, cross-vendor matches need a vendor master clean-up, and paid duplicates need a confirmed refund or offset. Teams that move these checks into AP automation software find similar duplicate detection built into invoice capture, a feature compared in our review of Ramp, BILL and Brex for AP automation.
··········
FOLLOW US FOR MORE.
·····
DATA STUDIOS
·····
datastudios.org




