AQL Sampling Plan: Pick Sample Sizes for Incoming Goods With AI

Coding Liquids tutorial cover featuring Sagnik Bhattacharya for AQL Sampling Plan: Pick Sample Sizes for Incoming Goods With AI.
Coding Liquids tutorial cover featuring Sagnik Bhattacharya for AQL Sampling Plan: Pick Sample Sizes for Incoming Goods With AI.

Take your lot size, pick an inspection level (general level II unless you have a reason), read the code letter, then read across to your AQL. A lot of 2,500 gives code K, a sample of 125 and, at AQL 2.5, accept up to 7 defects. AI can help, but check its lookup against the standard.

The check matters more than the speed. An assistant will name a sample size confidently even when it has slid one row or column on the grid, and a wrong sample size either lets bad goods through or wastes a day of inspection. The routine below uses AI for what it does well (explaining, formatting the inspection sheet, tallying results) and keeps a tested lookup for the numbers themselves.

Follow me on Instagram@sagnikteaches

The three inputs and what each one decides

An AQL plan is a pair of numbers, a sample size and an accept number, found from three inputs. The tables come from the attribute sampling standards ISO 2859-1 and ANSI/ASQ Z1.4, which share the same core tables (Z1.4 reproduces those of the old military standard MIL-STD-105E); check which one your supplier agreement names.

Connect on LinkedInSagnik Bhattacharya
  1. Lot size. The number of units in the delivery you are judging as one group. A lot should be one product from one production run where possible. Mixed pallets make a poor lot, because a sample drawn from them tells you about the mix.
  2. Inspection level. Controls how big the sample is for a given lot. The standard has three general levels. Level II is the default most buyers use. Level I gives a smaller sample, for low-risk goods. Level III gives a larger one, where you need more confidence. There are also special levels (S-1 to S-4) for small samples, used where inspection is destructive or costly.
  3. AQL (acceptance quality limit; older texts say acceptable quality level). The worst average defect rate, in per cent, that the plan treats as tolerable for a supplier's process over a run of lots. A lower AQL means a stricter plan. It is set separately for each class of defect.

Lot size and inspection level give you a code letter, a letter from A to Q. The code letter gives the sample size. The sample size and the AQL together give the accept number (Ac) and reject number (Re). If you find Ac or fewer defects in the sample, you accept the lot. If you find Re or more, you reject it. For single sampling under normal inspection the reject number is always one higher than the accept number, so there is no grey zone.

Subscribe on YouTube@sagnikteaches

Step one: lot size to code letter (general level II)

This is the table for general level II, as published in AQL guides. Check it against your own copy of the standard before you rely on it.

Lot sizeCode letterSample size
2 to 8A2
9 to 15B3
16 to 25C5
26 to 50D8
51 to 90E13
91 to 150F20
151 to 280G32
281 to 500H50
501 to 1,200J80
1,201 to 3,200K125
3,201 to 10,000L200
10,001 to 35,000M315
35,001 to 150,000N500
150,001 to 500,000P800
Over 500,000Q1,250

Notice how slowly the sample grows. A lot of 600 needs 80 units; a lot of 3,000 needs 125. Sampling is not a percentage of the delivery, which surprises people who expect to check 10 per cent. Level III moves you one code letter up, and level I, for lots above 50 units, two letters down: the same 2,500-unit lot is L (sample 200) at level III and H (sample 50) at level I, so read the table for the level you chose.

The Complete Excel Course with AI Integration thumbnail

The Complete Excel Course with AI Integration

From formulas and pivot tables to Power Query, DAX, VBA and AI with Copilot, ChatGPT and Claude — hands-on from the first lesson.

By Sagnik Bhattacharya and Virginia Thorn, Primetime Emmy Award winner

Buy now

Step two: the accept and reject numbers for the common AQLs

For normal inspection with a single sample, here are the rows most small buyers need, for AQLs 1.0, 1.5, 2.5 and 4.0. Again, this is a subset to check against the standard, not a replacement for it.

CodeSample sizeAQL 1.0 (Ac / Re)AQL 1.5AQL 2.5AQL 4.0
J802 / 33 / 45 / 67 / 8
K1253 / 45 / 67 / 810 / 11
L2005 / 67 / 810 / 1114 / 15

The smaller code letters (A to H) have rows where an arrow in the standard tells you to use a different sample size for that AQL, and that is exactly where AI and hurried humans slip. Whenever your code letter is H or smaller, read the arrows in the original table instead of trusting a summary like this one.

A common convention, not a rule, is to use AQL 0 for critical defects (anything unsafe or illegal), 2.5 for major defects (the product fails its job or the customer would return it) and 4.0 for minor defects (cosmetic or small departures). Inspection firms describe 2.5 as the most common choice for general consumer goods and 1.0 for higher-risk categories. Your own numbers come from what a defect costs you and your customer.

Worked example: a lot of 2,500 packaged accessories

This is an illustration with invented figures. Say a small online retailer receives 2,500 units of a packaged accessory in one delivery, one production run, ordered against one purchase order. The agreed terms are general level II, AQL 2.5 for major defects and 4.0 for minor, with zero critical defects.

  1. Code letter. Lot 2,500 sits in 1,201 to 3,200, so code K and a sample of 125.
  2. Major defects, AQL 2.5. K at 2.5 gives Ac 7, Re 8.
  3. Minor defects, AQL 4.0. K at 4.0 gives Ac 10, Re 11.
  4. Critical defects. AQL 0, so a single critical defect in the sample means rejection. The standard's tables do not cover a zero AQL; this is a term you write into the purchase agreement.
  5. Draw the sample. 125 units picked at random from across the lot: cartons from the top, middle and bottom of several pallets, and units from the middle of each carton, not the top layer.
  6. Inspect each unit against a written defect list, and tally.

Result of the inspection (illustrative): 0 critical, 5 major (two seals open, two missing inserts, one wrong label), 9 minor (scuffed packaging, uneven print). Five is below the major reject number of 8, and nine is below the minor reject number of 11, so the lot is accepted. Had the inspector found 8 majors, the lot would be rejected even though the other figures were good. Each defect class is judged on its own.

The same retailer's next delivery is 600 units. Code J, sample 80, majors at 2.5 give Ac 5, Re 6, and minors at 4.0 give Ac 7, Re 8. A third delivery of 400 units falls in 281 to 500, code H and a sample of 50; here the row has no arrow at AQL 2.5 and the plan is Ac 3, Re 4. A fourth of 4,000 units is code L: sample 200, majors Ac 10, Re 11.

Where AI fits and where it does not

Use AI for four jobs.

  • Explaining the plan to staff in the plain words of your own products.
  • Drafting the defect list for a product, sorting each defect into critical, major or minor, for you to approve.
  • Building the inspection sheet, with lot details, sample size, tally boxes and the accept and reject numbers pre-filled.
  • Totalling the tallies and writing the accept or reject result plus a note for the supplier.

Do not use it as the only source for the lookup itself. The grid is a two-way table with merged cells and arrows, and general assistants misalign it often enough to matter. If you do ask it for a plan, make it show its working:

I will give you the AQL table as text below. For a lot of 2,500 units at general inspection level II, find the code letter, the sample size, and the Ac and Re numbers for AQL 1.5, 2.5 and 4.0 in single sampling, normal inspection.
Show: the lot-size row you matched, the code letter, the sample size, and for each AQL the row and column you read. If any cell contains an arrow or you are unsure, say so instead of guessing.

[paste the table text here]

A careful reply names the 1,201 to 3,200 row, code K, 125 units and the three pairs. If the reply gives a sample size that is not one of the table's sample sizes (2, 3, 5, 8, 13, 20, 32, 50, 80, 125, 200, 315, 500, 800, 1,250), it has invented a number, and you can see that at a glance. Keep that list of valid sample sizes next to the sheet.

Build a lookup you can test

The safest approach is a small spreadsheet that does the lookup by formula, which you then test against cases you know. Put the lower bounds of the lot-size bands in column A (2, 9, 16, 26, 51, 91, 151, 281, 501, 1201, 3201, 10001, 35001, 150001, 500001), the code letters in column B and the sample sizes in column C. With the lot size in F2:

Code letter:   =INDEX($B$2:$B$16, MATCH(F2, $A$2:$A$16, 1))
Sample size:   =INDEX($C$2:$C$16, MATCH(F2, $A$2:$A$16, 1))

The "1" at the end tells the sheet to find the largest lower bound not above your lot size, which is what you want. Then add a second small table with one row per code letter and one pair of columns (Ac, Re) per AQL you actually use. Fill it from your copy of the standard, not from the web page you found. Ask the AI to write the formulas and a short test list, then run these tests before the sheet goes near a delivery:

  1. Lot 2 returns A and 2.
  2. Lot 8 returns A, and lot 9 returns B (a boundary).
  3. Lot 1,200 returns J, and lot 1,201 returns K.
  4. Lot 3,200 returns K, and lot 3,201 returns L.
  5. Lot 600 at AQL 2.5 returns 80 with Ac 5, Re 6.
  6. Lot 2,500 at AQL 2.5 returns 125 with Ac 7, Re 8.

Boundary tests are the useful ones, because a lookup that is off by one row passes the ordinary tests and fails at the edge. Have a second person check the table cells against the standard once, and then lock the sheet.

When the standard's own arrows change your sample size

For small lots at low AQLs, the standard prints an arrow instead of numbers. The arrow means "use the plan in the next row down (or up) in the direction shown", which brings a different sample size than the one the code letter suggests. If you used code D with a sample of 8 at a strict AQL, for instance, the arrow may send you to a bigger sample. The lookup table above avoids this by covering only code letters J to L at four AQLs, but if your lots are small, add the arrow cases by hand from the standard and write the new sample size in the cell. Do not let a model fill them in; it will write a number from the wrong row without any warning.

Also check the standard's switching rules, which let you move to tightened inspection after repeated rejections (for example two rejections within five consecutive lots) and to reduced inspection after a run of accepted lots. A small buyer can choose to run normal inspection only, as long as that is agreed with the supplier, but tightened inspection after a failure is a sensible habit to keep.

Draw the sample properly or the numbers mean nothing

The accept and reject numbers assume a random sample. A few practical rules for a goods-in bay:

  • Number the cartons or use a pallet map, and pick cartons with a random-number list. Ask the AI to produce a list of random carton numbers for a given count; this is a good use of it.
  • Take units from every pallet, not the nearest one.
  • Open the cartons the sample falls in and take units from the middle, not the top layer, which the packer may have tidied.
  • Inspect all the sample, not only until you find a defect. Stopping early distorts the tally.
  • Record what you inspected, how you picked it, and who did it.

Illustrative mistake: a warehouse checks the first 125 units from the first carton it opens. The supplier packed that carton last, after a reset of the machine, and it is the best carton in the lot. The sample passes; the other 19 cartons carry the seal fault. The plan was correct and the sampling was not.

An inspection sheet the team can fill in

Ask the AI to turn your defect list and the plan into a one-page form. A filled-in version (illustrative) looks like this:

FieldEntry
PO and lotPO-2287, lot 2,500 units, one production run
PlanGeneral level II, code K, sample 125
Critical (AQL 0)Ac 0, Re 1; found 0
Major (AQL 2.5)Ac 7, Re 8; found 5 (seal open 2, insert missing 2, wrong label 1)
Minor (AQL 4.0)Ac 10, Re 11; found 9
ResultAccept
Inspector, date[name], [date]

Record the five majors and the nine minors by type, even though the lot passed. If the same two defects appear in every delivery, a pass on paper is hiding a supplier problem. That is the point where a formal request to the supplier makes sense, and drafting a supplier corrective action request shows how.

What a failed lot should trigger

If the sample turns up 8 majors against a limit of 7, the decision is yours, and it is better made before the delivery arrives. A small buyer's options, from cheapest to dearest:

  1. Reject and return. Clean and simple, but slow if you need the stock.
  2. Supplier sorts. The supplier, or an inspector at the supplier's cost, screens the whole lot and replaces the defective units.
  3. You sort and charge back. Count your hours at a fixed rate and put it in writing before you start.
  4. Concession. Accept the lot at a reduced price, record the defect type, and treat it as a one-off.

The arithmetic helps. Suppose sorting 2,500 units takes 40 minutes per hundred, which is 16.7 hours. At $22 an hour that is $367. If the lot is worth $11,000, a 4 per cent price concession ($440) costs the supplier more than the sort would have, so either is reasonable, and you pick the one that fits your stock position.

Keep a record that shows which suppliers earn lighter checks

A log of every inspection, lot size, plan, defects found and decision, gives you something more useful than any single result: a history by supplier. Suppliers who pass twenty consecutive lots with few defects can reasonably move to a lighter plan, such as level I, by agreement. Suppliers who fail twice move to a heavier plan or to checks at source. The supplier tracking tutorial shows how to keep this in a sheet, and AI is good at asking questions of that history, for example "which three suppliers had the highest major defect rate over the last 12 lots?". For products where measuring beats counting, such as machined parts, first article inspection reports take over from sampling. And if you are weighing cameras against a human sample, the cost of AI visual inspection sets out when that makes sense.

Plan on about half a day to set up the sheet and the tests, then anything from half an hour to several hours per 125-unit sample, depending on how many checks each unit needs. If you would rather build the routine around your own products with someone, an AI implementation consultation can cover it.

Questions people ask about AQL sampling

Which AQL should I choose for incoming goods?

Many buyers use 0 for critical defects, 2.5 for major and 4.0 for minor on consumer goods, and 1.0 or lower for higher-risk products. There is no universal rule. Choose by the consequence of a defect reaching your customer, agree the numbers with the supplier in writing, and do not change them between lots without telling them.

Does AQL 2.5 mean 2.5 per cent of the lot may be defective?

Not exactly. AQL is the quality level a process is expected to meet for the plan to usually accept lots, not a guarantee about the lot in front of you. A lot with a 2.5 per cent defect rate will often be accepted, and a worse one will sometimes pass by luck of the sample.

Can I just ask AI for the sample size?

You can, but do not rely on the answer. Language models often misread the grid, mix up accept and reject columns, or skip arrow rows. Give the AI the table as text, ask it to name the row and column it used, then confirm with your own lookup or a copy of the standard.

What happens when a lot fails the plan?

Agree it in the purchase terms before it happens. Common outcomes are returning the lot, asking the supplier to sort it at their cost, sorting it yourself with the cost charged back, or accepting it on a recorded concession at a lower price. Whatever you choose, record the decision and the reason.

Further reads

Sources: the ISO 2859-1 and ANSI/ASQ Z1.4 attribute sampling standards (check against your own licensed copy); the MIL-STD-105E / Z1.4 tables as encoded in the AQLSchemes statistics package; QIMA's AQL guide; published switching-rule summaries. The worked example is illustrative.

Want an inspection routine you can trust?

On a 1:1 call we can look at what you receive, which defects matter to your customers, and set up a goods-in checking sheet your warehouse team can use without calling the office.

Book a 1:1 call with me