---
name: find-duplicate-invoice-records
description: "Find supplier invoices entered twice by grouping on buyer, supplier, document type, currency and exact reference, and separate duplicate candidates from conflicting versions and missing references. Use when checking accounts payable for duplicate bills before a payment run."
license: CC-BY-4.0
metadata:
  author: Raq.com
  version: "2026-11-22"
  homepage: https://skills.raq.com/skills/find-duplicate-invoice-records
---

# Find duplicate supplier invoice records

Group repeated invoice references and distinguish a duplicate candidate from conflicting versions or a genuine credit.

## When to use this skill

- Before a payment run, someone wants to check the payables list for invoices entered twice.
- A supplier says it was paid twice, or an invoice number appears more than once in the ledger.
- A group with several companies exports one payables list and needs repeats checked within each company.

## When not to use it

- Reconciling one supplier's statement with the ledger. Use the supplier statement reconciliation skill.
- A request to change a supplier's bank details, or an invoice that looks fake. Follow the business's fraud checks and confirm with the supplier using contact details you already hold, not those on the invoice.
- Deleting, reversing or cancelling records. The report flags candidates; a person with payables authority decides and corrects.

## What you need

- Accounts payable export with record ID, buying entity, supplier ID, document type, invoice reference, signed total and currency
- Supplier-specific reference normalisation rules if available

## Ask before you start

If any of these are missing or unclear, ask before doing the work.

- Does the export cover more than one company, and is the buying company on each row? Duplicates only mean something within one buyer.
- Which column holds the supplier's own invoice number, as opposed to your internal record ID?
- Have any of these records been paid, cancelled or reversed? That decides whether to hold a payment or ask for a refund.
- Does any supplier have an agreed reference format, such as prefixes or leading zeros, that you treat as the same number?

## Method

1. Keep distinct purchasing legal entities in separate scopes. A branch, delivery site or cost centre alone does not establish a different legal buyer. If a multi-entity export omits the buyer, flag the uncertain groups for review.
2. Within each scope, group by supplier ID, document type, currency and the supplier's reference exactly as recorded. Trim outer whitespace only. Keep leading zeros, prefixes and letters unless the supplier has a documented rule, because the number identifies a document within that supplier's own series.
3. Within each repeated key compare signed gross totals. If every amount agrees, flag the group as a duplicate candidate. If any amount differs, classify the whole group as conflicting versions.
4. Flag records with no supplier reference separately, even when the amount and date match another invoice. Do not fill a missing reference from the amount or strip prefixes by guesswork.
5. Note near-matches outside the groups for checking, not as candidates: the same supplier, amount and date with a reference that differs only in format, or two supplier IDs sharing a VAT number or bank account.
6. For each candidate keep every internal record ID and check the originals, purchase order, goods receipt, posting, cancellation and payment history. Recommend holding the unpaid copy, or asking the supplier for a credit or refund if both were paid. Make no deletions or payment decisions.

## Checks before you deliver

- Two suppliers can issue the same invoice number.
- A genuine credit or instalment might have the same absolute amount, so grouping on price is unreliable.
- Stripping leading zeros or prefixes merges different documents: 0012 and 12 are not the same reference without the supplier's confirmation.
- Treating two amounts under one reference as two valid invoices. A reissued invoice with a corrected price is a conflict, and the supplier must confirm which version stands.
- Grouping across companies in a group export makes separate obligations of different legal buyers look like duplicates.

## How to present the result

Lead with the number of candidate groups and the amount at risk of double payment. List each group with record IDs, supplier, reference, amount and payment status, and the check needed against the original. Then show conflicting versions with the amounts that differ, records missing a reference, and which items to hold from the next payment run.

## Worked example

**Request:** Check these records for possible duplicate bills.

**Supplied material:**

```text
All GBP. id | supplier | type | ref | total
A1 Vale invoice 0012 80
A2 Vale invoice 0012 80
B1 Moss invoice 0012 80
C1 Vale credit 0012 -80
A3 Vale invoice 12 80
```

**Answer:** Check A1 and A2 against Vale’s original invoice 0012 and the posting/payment history before correcting either entry. Both are £80. B1 is from Moss, C1 is a credit, and A3 has reference 12 rather than 0012.

## Structured output for tests

For an ordinary job, answer in the format above and point back to the supplied evidence. Use this structure only for the test cases published with this skill, or when someone asks for structured JSON.

Return candidates and conflicts as arrays of groups of record IDs. Sort IDs within groups and groups by their first ID. Return missing_reference as a sorted ID array. Preserve leading zeroes.

## Sources

- [GOV.UK · What an invoice must include](https://www.gov.uk/invoicing-and-taking-payment-from-customers/invoices-what-they-must-include): UK guidance says every invoice must carry a unique identification number together with the supplier's and the customer's names and addresses. The skill therefore groups on the supplier and the buyer as well as the reference.
- [HMRC · VAT invoice details (VATREC5010)](https://www.gov.uk/hmrc-internal-manuals/vat-trader-records/vatrec5010): HMRC's manual says a full VAT invoice must have a sequential number based on one or more series which uniquely identifies the document, and that the number may include letters. This is why the skill keeps each reference exactly as recorded, within each supplier.
- [Microsoft · External document numbers on purchase documents](https://learn.microsoft.com/en-us/dynamics365/business-central/purchasing-ext-doc-no): Business Central can make the vendor's own invoice number mandatory before a purchase invoice is posted and lets you search posted entries by it. A record with no supplier reference cannot be checked this way, so the skill reports it separately.

Test cases and an answer checker for this skill: https://skills.raq.com/skills/find-duplicate-invoice-records
