500 free credits, no card. Try Smalt AI →

Operations

How do I do a three-way match of purchase orders, receipts and invoices in Excel

Put POs, receipts and invoices in three Excel tables, total each by PO line with SUMIFS, then flag quantity and price gaps against a tolerance you set.

Smalt AI team ·

Put purchase order lines, goods receipts and invoices in three Excel tables, give each row a PO-and-line key, and total receipts and invoices per PO line with SUMIFS. Then compare invoiced quantity to received quantity, and invoiced unit price to PO price within a tolerance you choose. Anything that fails is an exception for a person to resolve.

How to do it

Three-way matching has a precise meaning. Microsoft’s accounts payable documentation describes two-way matching as comparing the invoice price to the PO price, and three-way matching as also comparing the invoice quantity to the quantity on the product receipt. A quantity difference counts as a quantity error. The steps below are a method built from those definitions, not a recipe from any one source.

Set up three tables

Create one Excel Table each for PO lines, receipts and invoices (Ctrl+T). Each needs a PO number and a line number. In every table, add a Key column that joins them:

=[@[PO number]]&"|"&[@[Line]]

The key matters because one PO line often has several receipts and several invoices. A single lookup would return only the first one, so you total them instead.

Total receipts and invoices per PO line

On the PO table, add three columns using SUMIFS:

  • Rcv_Qty: =SUMIFS(Receipts[Qty],Receipts[Key],[@Key])
  • Inv_Qty: =SUMIFS(Invoices[Qty],Invoices[Key],[@Key])
  • Inv_Amt: =SUMIFS(Invoices[Amount],Invoices[Key],[@Key])

Totalling accumulates earlier invoices before comparing, which is Microsoft’s guidance for partially invoiced lines. The status formula below then compares quantities and prices only on what has been received and invoiced so far.

Calculate the price variance

Microsoft defines net unit price as line net amount divided by line quantity. Do the same, then compare to the PO price:

  • Price_Var%: =IFERROR((([@Inv_Amt]/[@Inv_Qty])-[@[PO price]])/[@[PO price]],0)
  • Total_Var: =[@Inv_Amt]-[@Inv_Qty]*[@[PO price]]

Total_Var measures the variance on the quantity actually invoiced, not the full PO quantity. If it used the PO quantity, a line with 40 of 100 units invoiced at the right price would show a false gap of 400 minus 1,000. The IFERROR returns 0 when nothing has been invoiced yet, so an unbilled line does not show a divide-by-zero error.

Set tolerances in named cells

Put a percentage tolerance in a cell named TolPct and a currency tolerance in a cell named TolAmt. Microsoft’s documentation allows a tolerance as a percentage, an amount, or both, and when both are set a line fails if either is exceeded. Its examples (105.00 against a 100.00 PO price passes a 10% tolerance, 150.00 fails) illustrate the product’s behaviour, not a standard. Choose your own limits with your finance lead.

Write the status column

=IF(AND([@Rcv_Qty]=0,[@Inv_Qty]=0),"Not invoiced",
 IF([@Inv_Qty]>[@Rcv_Qty],"Qty exception",
 IF(OR(ABS([@[Price_Var%]])>TolPct,ABS([@Total_Var])>TolAmt),"Price exception",
 IF([@Rcv_Qty]>[@Inv_Qty],"Awaiting invoice","Match"))))

The order of the tests matters. Lines with nothing received or invoiced are set aside first. Invoiced quantity above received quantity is a “Qty exception”. Price is checked on the invoiced quantity. Only then does received-but-not-yet-invoiced become “Awaiting invoice”, which is a timing status, not an error. “Match” means invoiced equals received at an acceptable price. It does not mean the whole PO is complete.

With a 5% price tolerance, the formula treats four lines like this:

PO line (qty at price)ReceivedInvoicedStatus
100 at 10.004040 at 10.00Match
100 at 10.006040 at 10.00Awaiting invoice
100 at 10.004040 at 11.50Price exception (15% over)
100 at 10.00040 at 10.00Qty exception

A line with an invoice but no receipt lands in “Qty exception” because received quantity is zero. That mirrors Microsoft’s three-way matching policies, where a line with no posted receipt fails the quantity match even when the price agrees.

Find missing rows with Power Query

SUMIFS returns 0 for a PO line that has no receipt, which can look the same as a real zero. To list unmatched rows explicitly, load the tables into Power Query and merge them with a left outer join: PO lines as the first table, receipts as the second, matched on Key. Expand the merged column, and PO lines with no receipt come back as null. Repeat for invoices.

In Microsoft 365, Excel 2021, Excel 2024 or Excel for the web, XLOOKUP can label the gap: =XLOOKUP([@Key],Receipts[Key],Receipts[Qty],"No receipt"). It is missing from Excel 2016 and 2019 and returns only the first match, so keep SUMIFS for totals.

Sort exceptions by who fixes them

Corpay’s three-way matching guide, a payments vendor’s article, lists the usual exception types: quantity variance (overshipment, back-order, unit-of-measure mismatch), price variance, a missing PO reference, an invoice covering several POs, and partial receipt. Its suggestion, one vendor’s view rather than a standard, is to send price questions to procurement and quantity questions to receiving. You could add an Owner column driven by the status text and filter each group to the right person. Once exceptions are cleared, check the approved invoices for repeats with a duplicate invoice check.

Doing it with an AI coworker

If the monthly match is the job you want to hand off, Smalt can read a .zip of invoices and compare them to a PO sheet. That covers the invoice-to-PO comparison only. Receipts still need checking with the formulas above, and those formulas are also a way to audit whatever Smalt returns. See how operations teams use Smalt for the wider picture.

What to check before you rely on it

  • Unit of measure. An invoice in cases against a PO in each produces a quantity error that is really a unit mismatch. Convert units before matching.
  • Freight, tax and discounts. These often arrive as separate invoice lines with no PO line. Match goods first and handle them on their own.
  • One invoice, several POs. The key assumes one PO line per invoice row. Split multi-PO invoices into one row per PO line first.
  • Excel version. The SUMIFS method works in any recent Excel. The XLOOKUP and Power Query steps depend on your version and setup.
  • Where three-way matching applies. Microsoft’s policies describe three-way matching for higher-risk items and vendors, with two-way matching elsewhere. You can mirror that by skipping the receipt check for low-risk lines.
  • Approving exceptions. The same policies let exceptions be approved before posting. A status of “Match” only means the numbers agree, so keep a person responsible for deciding what to do with every exception, and record who approved it. A purchase order approval process upstream keeps the PO side of the match clean.

Smalt is an AI coworker that takes jobs like this end to end and hands back the finished file.