Skip to main content

3-Way Match in Excel: A Free Template With Tolerance and Status Columns

10 min readPipeSheets Team

A 3-way match checks each vendor invoice line against the purchase order line that authorised it and the receiving record that proves the goods arrived, and only approves payment when quantity and price agree within a tolerance. You can do it in Excel with three input sheets and one match sheet: XLOOKUP pulls the PO price and quantity, SUMIFS totals the receipts, and a few IF formulas produce a MATCH or EXCEPTION status with a reason. The template below does exactly that, and every formula is shown so you can adapt it.

Download: three-way-match-template.xlsx. It contains sample data on four sheets (Match, PO, Receipts, Invoices) plus a Settings sheet for the tolerances. It uses XLOOKUP, so you need Excel 2021, Excel 365 or a current LibreOffice. Note that this is a working spreadsheet, not accounting advice: tolerance values are starting points, not a standard.

2-way, 3-way and 4-way match, briefly

MatchDocuments comparedTypical use
2-wayPurchase order + invoiceServices and subscriptions, where there is no physical receipt
3-wayPurchase order + goods receipt + invoicePhysical goods; the default for most AP teams
4-wayAdds an inspection or quality recordRegulated or inspected goods

The point of the receipt is simple: a PO proves you ordered it and an invoice proves the vendor wants paying, but only the receipt proves it arrived. Skipping it is how you pay for short shipments.

How the template is laid out

Everything joins on one key: PO number plus line number, written as PO-1001-2. Each input sheet builds that key with a formula so you never type it.

Sheets and columns
SheetColumnsNotes
SettingsPrice tolerance %, price tolerance $ per line, quantity tolerance %Edit B2:B4. Defaults 2%, $5, 3%.
POPO Number, Line, Key, SKU, Description, Qty Ordered, Unit Price, Line TotalKey = PO Number & "-" & Line
ReceiptsPO Number, Line, Key, Receipt Date, Qty ReceivedSeveral receipts per line are fine; they are summed
InvoicesInvoice Number, Vendor, PO Number, Line, Key, Qty Invoiced, Unit Price, Line TotalOne row per invoice line
MatchOne row per invoice line, with lookups, differences, Duplicate?, Status, ReasonThis is the sheet you review

The formulas, column by column

On the Match sheet, row 2 is the first invoice line. C is the key, copied from Invoices!E2. The rest:

Pull the PO quantity and price (D and G)

D2: =IFERROR(XLOOKUP(C2,PO!$C:$C,PO!$F:$F),"NO PO")
G2: =IFERROR(XLOOKUP(C2,PO!$C:$C,PO!$G:$G),"")

If the key is not on the PO sheet, D says NO PO and the status logic stops there. That catches the single most common exception: an invoice quoting a PO number you never issued, or no PO number at all.

Total the receipts for that line (E)

E2: =IF(D2="NO PO","",SUMIFS(Receipts!$E:$E,Receipts!$C:$C,C2))

SUMIFS rather than XLOOKUP, because goods often arrive in several deliveries. A line with no receipts sums to 0, which the status logic treats as "invoiced before goods receipt".

Price and quantity differences (I to L)

I2  Price Diff $:        =IF(G2="","",ROUND((H2-G2)*F2,2))
J2  Price Diff %:        =IF(OR(G2="",G2=0),"",(H2-G2)/G2)
K2  Qty Diff vs Received: =IF(E2="","",F2-E2)
L2  Qty Diff %:          =IF(OR(E2="",E2=0),"",(F2-E2)/E2)

Price difference in dollars is per line (unit difference times quantity invoiced), because a one-cent unit difference on 10,000 units is a $100 problem and the percentage alone hides it. Quantity is compared with the quantity *received*, not ordered: being invoiced for what arrived is correct even if the PO said more.

Duplicate invoice lines (M)

M2: =IF(COUNTIFS($A$2:$A$8,A2,$C$2:$C$8,C2)>1,"DUP","")

Same invoice number and same key appearing twice is a duplicate submission. Extend the ranges to your last row. For a looser check (same vendor, same key, same amount, different invoice number), add a second COUNTIFS on B, C and H.

Status and reason (N and O)

N2: =IF(D2="NO PO","EXCEPTION",
     IF(M2="DUP","EXCEPTION",
     IF(E2=0,"EXCEPTION",
     IF(AND(ABS(J2)>Settings!$B$2,ABS(I2)>Settings!$B$3),"EXCEPTION",
     IF(ABS(L2)>Settings!$B$4,"EXCEPTION","MATCH")))))

O2: =IF(D2="NO PO","No PO found for this key",
     IF(M2="DUP","Duplicate invoice line",
     IF(E2=0,"Invoiced before goods receipt",
     IF(AND(ABS(J2)>Settings!$B$2,ABS(I2)>Settings!$B$3),"Unit price outside tolerance",
     IF(ABS(L2)>Settings!$B$4,"Quantity differs from receipt","")))))

The price test passes if the line is within *either* the percentage or the dollar tolerance. That is deliberate: a 12% difference on a $1.25 bracket is $0.15 a unit, and on a 10-unit line it is below any sensible $ threshold, while 0.5% on a $50,000 line is $250 and should stop. If you prefer a stricter rule, change AND to OR.

What the sample data shows

The template ships with seven invoice lines chosen to trigger each path once. With the default tolerances (2%, $5, 3%), the Match sheet should read as follows. We generated the file with a script and recomputed every expected status independently in Python; it was not opened in a desktop Excel on the machine that built it, so if a cell shows something different in your copy, that is worth a note to us.

Expected results with default settings
InvoiceKeyWhat is going onStatusReason
INV-77PO-1001-1100 units at $4.55 vs PO $4.50: +1.1%, $5.00 per lineMATCHWithin tolerance
INV-77PO-1001-250 invoiced, 48 received (short shipment): +4.2%EXCEPTIONQuantity differs from receipt
INV-78PO-1002-1200 units at $1.40 vs PO $1.25: +12%, $30 per lineEXCEPTIONUnit price outside tolerance
INV-79PO-1003-1Exact match, but the line appears twice on the same invoiceEXCEPTIONDuplicate invoice line
INV-80PO-1004-1No receipt yetEXCEPTIONInvoiced before goods receipt
INV-81PO-9999-1PO number does not existEXCEPTIONNo PO found for this key
INV-79PO-1003-1The duplicate of row 4EXCEPTIONDuplicate invoice line

Choosing tolerances

There is no published standard; these are ranges we see described as common practice, and your auditor or controller may have a view.

Common-practice starting points (not a standard)
CheckTypical toleranceWhen to use zero
Unit price1% to 5%, or a fixed amount per line such as $5 to $50Contracted or catalogue prices that must not move
Quantity3% to 5% for bulk, weighed or perishable goodsSerialised items, capital equipment, anything counted one by one
Freight and taxOften matched separately against a quote rather than the PO lineWhen the PO includes delivered pricing

The exceptions you will actually see

In rough order of frequency, and what the template does with each:

  • No PO number on the invoice, or a number you did not issue: NO PO. Send it back to the vendor or raise a retrospective PO, depending on policy.
  • Invoice before goods receipt: receipts sum to 0. Hold the invoice until receiving posts; do not pay on the vendor's say-so.
  • Short shipment or over-shipment: quantity outside tolerance. Pay for what arrived, or wait for the back-order.
  • Price increase: unit price outside tolerance. Approve against a quote, or dispute.
  • Duplicate invoice: DUP. The second copy is the one to reject; the template flags both so you can see them together.
  • Freight or tax added on the invoice but not the PO: the template matches the line, and the header-level total will not. Add a header check if this is common for you.

Getting the three files into shape first

The template assumes the PO number is written the same way in all three sources. It rarely is. ERP exports give "PO-1001", the vendor types "PO 1001" or "1001", and receiving writes "po1001". XLOOKUP matches text exactly, so every variant is a NO PO. Before you paste the data in, normalise the key column in each file: trim, uppercase, strip spaces, and standardise the prefix. Leading zeros matter too: "001042" and "1042" are different keys, and Excel will silently drop the zeros if the column is numeric.

That key-cleaning step is the same problem as merging inventory CSVs by SKU, and the same deterministic steps fix it: trim, case, find-and-replace on the prefix, and a dedupe on the key before the join. PipeSheets does those as previewable steps and can also perform the join itself on one exact key across up to 20 files, which gives you the matched and unmatched rows as a CSV before you open Excel. It does not do tolerance comparison; that stays in the template, where you can see the thresholds.

Extending the template

  • Header-level check: add a sheet that sums Invoices!H by invoice number and compares it with the vendor's invoice total, to catch freight, tax and rounding.
  • Date window: add a column for days between receipt date and invoice date, and flag negatives (invoiced before receipt by date, not just by quantity).
  • Approval trail: add Reviewed By and Decision columns to the Match sheet and keep each month's file.
  • Larger volumes: convert the three input ranges to tables so the formulas extend automatically, or move the join to Power Query and keep only the tolerance logic in formulas.

If your purchase and receiving data comes out of different systems with different column names, the merge bank and Stripe exports page shows how a one-key merge works in PipeSheets; the mechanics are identical for PO, receipt and invoice files, and the output drops straight into the input sheets of this template.

Try the automated solution

PipeSheets can fix these issues automatically. Create a free account to clean your first file.

Create a free account

Or see how it works: Merge Bank & Stripe Exports