Allergen Matrix Template: Build From Recipes With AI, Then Verify

Coding Liquids tutorial cover featuring Sagnik Bhattacharya for Allergen Matrix Template: Build From Recipes With AI, Then Verify.
Coding Liquids tutorial cover featuring Sagnik Bhattacharya for Allergen Matrix Template: Build From Recipes With AI, Then Verify.

List every recipe line, find each ingredient's allergens from the supplier's specification, let AI do the first pass to draft those columns, and build the matrix with spreadsheet formulas so a missing answer shows as CHECK. Then add cross-contact notes and have a named, trained person verify and sign it off.

The order matters. If you ask a chatbot for "an allergen matrix for these ten recipes", it will return a neat grid that looks finished and is built on its general knowledge of what such foods contain, not on what your supplier's soy sauce or chocolate chips actually contain. A matrix is a controlled document. The working method below keeps the AI in the drafting seat and puts the evidence, the formulas and the signature elsewhere.

Follow me on Instagram@sagnikteaches

What the matrix has to say, and what it must never say by silence

An allergen matrix is a grid: products or recipes down the side, allergens across the top, and a mark where the product contains that allergen as an ingredient. Many markets regulate a list of 14 allergens (celery, cereals containing gluten, crustaceans, eggs, fish, lupin, milk, molluscs, mustard, tree nuts, peanuts, sesame, soybeans, and sulphur dioxide or sulphites at more than 10 mg per kg or per litre, measured as total sulphur dioxide). Other markets use a shorter or differently grouped list; one widely used list has nine major allergens and names wheat rather than every cereal containing gluten. Use the list your own regulator publishes and put its exact names in your header row.

Connect on LinkedInSagnik Bhattacharya

Two rules stop a matrix from misleading people:

Subscribe on YouTube@sagnikteaches
  • Blank must mean "checked and absent", never "not looked at". That is why the template below fills unknowns with the word CHECK and lets the matrix show CHECK until someone resolves it.
  • Ingredient level, not recipe level. The allergens come from what is in each ingredient, including compound ingredients, which is where most errors start.
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

The maker in this walk-through

A small producer makes packaged goods in one kitchen: an oat and seed flapjack, a pesto, a lemon drizzle loaf, a chicken curry sauce and a granola. Twelve recipes in all, around 70 distinct ingredients, and five regular suppliers. Today the allergen information sits in a mix of old label files and the owner's memory. The goal is a single spreadsheet that (a) lists allergens by recipe, (b) shows what is unconfirmed, and (c) is reviewed and signed off by a named person each quarter.

Sheet one: the ingredient master list

This is the foundation. One row per purchased ingredient, as bought, with the supplier's product code. Columns:

  • Ingredient (exactly as the supplier names it)
  • Supplier and product code
  • Specification date and file name (where the spec is stored)
  • One column per regulated allergen, holding Y, N or CHECK
  • Sub-ingredients as listed by the supplier (for compound items)
  • Checked by and date

Start with every ingredient set to CHECK in every allergen column. Do not start with the model's guess, because a guess pre-filled into the sheet looks like an answer. Instead, use the model to draft from the supplier's own documents.

Drafting from the specification, not from memory

Gather each supplier's specification sheet or ingredient statement (most suppliers send a PDF on request). For each one, paste the relevant text and use this prompt:

Below is a supplier's ingredient statement or specification text for one product.
List every allergen from this regulated list that the text says the product contains, quoting the words you relied on: celery, cereals containing gluten, crustaceans, eggs, fish, lupin, milk, molluscs, mustard, tree nuts, peanuts, sesame, soybeans, sulphur dioxide or sulphites.
Also list any "may contain" or cross-contact statement exactly as written.
If the text does not mention an allergen, do not guess: write "not stated".
Do not use general knowledge about what the product usually contains.

TEXT:
[paste the specification text]

Sample input and output for one ingredient (illustrative):

TEXT: "Soy sauce: water, soybeans, wheat, salt. Allergens: soy, wheat. Produced in a facility that also handles sesame."

OUTPUT:
Contains: soybeans ("soybeans, wheat ... Allergens: soy"), cereals containing gluten ("wheat").
Cross-contact statement: "Produced in a facility that also handles sesame."
Not stated: celery, crustaceans, eggs, fish, lupin, milk, molluscs, mustard, tree nuts, peanuts, sesame (as an ingredient), sulphites.

A person then copies the confirmed Y values into the master sheet, sets the others to N only when the specification clearly covers that allergen, and leaves CHECK where the text is silent. "Not stated" is not the same as "absent": a one-line ingredient statement might omit sulphites that a full specification would list. When a spec is thin, ask the supplier for the full specification.

Sheet two: recipe lines

One row per ingredient per recipe, with quantity. For the lemon drizzle loaf (illustrative):

RecipeIngredientQuantity (g)
Lemon drizzle loafPlain flour250
Lemon drizzle loafButter225
Lemon drizzle loafCaster sugar225
Lemon drizzle loafEgg, liquid pasteurised200
Lemon drizzle loafLemon curd (compound)60

If your recipes already live in a costing sheet, copy the same ingredient names. The recipe costing spreadsheet tutorial builds that table, and the names must match the master list exactly, because the lookups below match on text. A model can help here: paste the recipe cards and ask it to standardise the ingredient names to those in your master list and return anything that doesn't match as "no match". Check that list yourself.

Pulling allergens into each line with a lookup

Beside each recipe line, add one column per allergen. In Excel, with the master list as a table named Ingredients and recipe lines as a table named RecipeLines, the Milk column takes this formula:

=XLOOKUP([@Ingredient], Ingredients[Ingredient], Ingredients[Milk], "CHECK")

The last argument is the safety feature: if the ingredient name is not in the master list at all, the cell says CHECK rather than a blank or an error. Fill the same formula across the other allergen columns, changing the return column each time. Spreadsheets without XLOOKUP can use INDEX and MATCH with an IFERROR that returns "CHECK".

One gap remains. If an ingredient is in the master list but someone left its Milk cell empty, the lookup brings back a zero or an empty result rather than CHECK, and the matrix formula below would read that as N. Put a data-validation list (Y, N, CHECK) on every allergen column of the master sheet, and a COUNTBLANK total beside it that must read zero, so an empty cell is caught before it can turn into a false "free from".

Sheet three: the matrix itself

One row per recipe, one column per allergen. The cell formula looks across the recipe's lines:

=IF(COUNTIFS(RecipeLines[Recipe],$A2,RecipeLines[Milk],"CHECK")>0,"CHECK",
 IF(COUNTIFS(RecipeLines[Recipe],$A2,RecipeLines[Milk],"Y")>0,"Y","N"))

The order of the tests is the point: CHECK wins over Y, which wins over N, so the matrix can only say N when every ingredient in the recipe is confirmed free of that allergen. Add a conditional-format rule that fills CHECK cells amber and Y cells red, and a count in the corner of how many CHECKs remain. The matrix is only ready for use when that count is zero.

Result for the lemon drizzle loaf (illustrative): Cereals containing gluten Y, Eggs Y, Milk Y (butter, and the curd lists milk), Sulphites CHECK, because the lemon curd specification does not mention them either way. The producer now has a concrete job: email the curd supplier for the full specification, not guess.

Hidden allergens: compound ingredients and processing aids

The two most common sources of error are not exotic. They are ingredients that contain other ingredients, and things added during production that never appear on a recipe card. Run a second AI pass specifically over your recipe lines:

Here is a recipe's ingredient list. For each ingredient, say whether it is likely to be a compound ingredient (made of other ingredients), and for each compound ingredient list the sub-ingredients and allergens that products of that kind often contain, as questions to confirm with the supplier. Also list any processing aids or release agents that bakers and food makers commonly use with this kind of recipe, such as oil sprays on tins, that may contain allergens.
Frame everything as questions. Do not state what my product contains.

RECIPE:
[paste ingredient list]

Sample output (illustrative): "Worcestershire-style sauce: often contains fish (anchovy) and sometimes gluten; confirm with supplier. Pesto: pine nuts are not among the nuts named on the 14-allergen list, so check how your own list treats them; cheese contains milk; check whether the basil paste uses cashew. Tin release spray: may contain soya lecithin; confirm." Each is a question for a supplier, never an answer for the matrix. That framing in the prompt is deliberate: it makes the chatbot widen your checking list instead of narrowing it.

Cross-contact: a separate layer with a named decision-maker

Cross-contact means an allergen that is not a recipe ingredient but could reach the product through shared equipment, surfaces, air or people. It belongs in its own set of columns, because it answers a different question: not "what is in the recipe?" but "what could get into it?"

ItemShared withControl in placeResidual riskDecision and owner
Flapjack tinsGranola traysDishwasher cycle, visual checkLow for oats, high for tree nuts in granolaBake flapjacks before granola; reviewed by [owner]
Mixer bowlLemon loaf and nut cakeHot wash, separate paddlesModerateRun nut cake last in the day; [owner]
Packing tableAllCleaned between runsLowPrecautionary statement not needed; [owner]

Use AI to turn your floor plan, kit list and daily schedule into this table of questions, and to suggest controls you may not have considered, such as colour-coded tools or scheduling allergen-containing batches last. Whether a precautionary "may contain" statement is needed, and what wording to use, is a risk assessment under your regulator's guidance, taken by a person who knows the premises. The chatbot's role stops at drafting the table.

Supplier spec checks: the document comparison AI is good at

Once a year, and whenever a supplier sends an updated specification, compare the new text to the one on file. This is where AI saves real time, because reading two near-identical PDFs for a changed line is tedious.

Compare these two versions of a supplier's specification for the same product. List every difference in ingredients, allergen statements and "may contain" wording. Quote the old and new text for each difference. If there are no differences in those areas, say so.

OLD:
[paste]
NEW:
[paste]

A realistic find: the old statement read "Milk chocolate chips: sugar, cocoa mass, cocoa butter, whole milk powder, emulsifier (soya lecithin)"; the new one adds "may contain hazelnuts". That one line changes a flapjack from no nut warning to a decision about precautionary labelling, which is a person's job, and it flows into the label. The tutorial on supplier specification changes that break labels follows that thread through to the print file.

The finished matrix for five of the twelve recipes

This is what the output sheet looks like once the master list is complete (illustrative; a real one carries all the regulated columns). Y means an ingredient in the recipe contains the allergen, N means every ingredient is confirmed free of it by a specification, and a column the producer has not yet resolved would show CHECK.

RecipeGluten cerealsMilkEggsSoyaTree nutsSesameSulphites
Oat and seed flapjackY (oats)Y (butter)NNNY (seed mix)N
Basil pestoNY (cheese)NNY (cashews in the basil paste)NN
Lemon drizzle loafYYYNNNCHECK (curd spec)
Chicken curry sauceNY (cream)NY (soy sauce)NNN
GranolaYNNNY (almonds)Y (tahini coating)Y (dried apricots)

Look at the flapjack and pesto rows for the cases a first draft tends to get wrong. The 14-allergen list names oats among the cereals containing gluten, so on that list the flapjack's cell is Y even when the oats are specified as uncontaminated; whether they were handled alongside wheat is a cross-contact entry, and a "gluten free" claim is a separate test again (below). Under a list that names wheat rather than gluten cereals, the oats question moves to the cross-contact layer. The pesto's Y comes from the cashews in its basil paste, not the pine nuts, which are not among the nuts the 14-allergen list names; a pesto made with pine nuts alone needs your own list's ruling and a clear note in the cell. The granola's sulphites come from dried fruit, which many people don't think of as a preserved ingredient. And the loaf's CHECK is correct behaviour: the sheet is telling you what you do not yet know.

A before and after: one ingredient list through the process

Take the curry sauce card as it sat in a notebook (before):

Curry sauce: onions, garlic, tinned tomatoes, curry paste, cream, chicken stock, soy sauce, sugar, oil

After running the standardise-names prompt against the master list, then the compound-ingredient prompt, the card becomes a set of lines with open questions (illustrative):

  • Curry paste: compound, sub-ingredients not on file. Ask the supplier for the full specification; common questions are mustard, celery, fish, sesame and gluten-containing thickeners.
  • Chicken stock: compound. Ask about celery and about milk or gluten in the stock base.
  • Soy sauce: spec on file, contains soybeans and wheat (sesame facility statement noted).
  • Cream: spec on file, milk.
  • Oil: confirm which oil, and whether it is refined or a blend containing nut or sesame oil.

The change is not that AI found the answers. It converted one line of vague ingredients into five specific supplier questions, three of which would otherwise have been missed, and it did so in about a minute.

Free-from claims are a stricter test than the matrix

A matrix records what a recipe contains. A claim such as "gluten free" or "dairy free" on the pack is a promise, and many markets set a specific legal threshold and conditions for it. Do not let a clean-looking row justify a claim. For each claim you make, write down the rule you rely on, the evidence (specifications, supplier declarations, any testing) and the cross-contact controls, then have your sign-off person check that file. A chatbot can help you list what evidence to gather, but whether you meet the rule is for the person responsible, with advice from your local food authority or a qualified adviser if you are unsure.

Making a version staff and customers can use

The working matrix has CHECK cells, document references and cross-contact columns. The version at the counter or on the website should have none of that. Produce a clean "customer view" from the signed-off matrix: product name, allergens it contains, and the standard sentence your site or shop uses for cross-contact. Ask the chatbot to format the signed-off rows into a printable table and to flag any row that is not in the signed-off sheet, as a check on your copy-and-paste. Print the version date at the foot of the page, and bin old copies whenever the matrix is re-signed.

Train the people who answer questions to use that page and to say "I will check" when a customer asks about something it doesn't cover. Staff guessing from memory is exactly the failure the matrix exists to replace. A short laminated card for the pass or the stall counter, listing the allergens in each product and the cross-contact sentence, covers most enquiries; anything unusual goes to the named person.

The sign-off page

A matrix becomes a control document when someone accountable signs it. Put this block on its own sheet:

Allergen matrix sign-off
Matrix version: [number]     Recipes covered: [list or count]
Open CHECK cells at sign-off: 0
Every ingredient specification on file and in date: Yes / No (list exceptions)
Cross-contact table reviewed this period: Yes / No
Precautionary statement decisions recorded: Yes / No
Labels compared against the matrix for: [list of products]
Reviewed by: [name], trained in allergen management: Yes / No
Signed: [signature]   Date: [date]

Keep each signed version rather than overwriting it, so you can show what the matrix said at any point. If an inspector or customer asks, this is the document that answers them, not a chat history. For the legal text on the label itself, see AI label design checks for small food producers.

Testing the matrix against the packets

Before you trust the matrix, try to break it. Pick three recipes and do this by hand:

  1. Open the real packets and read the ingredient lists from the actual bags in the store room, not the files. Do the allergens on the pack match the specification you stored?
  2. Take one finished label and tick each allergen it declares against the matrix row. They should agree in both directions: nothing on the label that the matrix lacks, nothing in the matrix that the label omits.
  3. Pick one ingredient at random, and trace it from recipe line to master sheet to specification PDF. Time it. If it takes more than a couple of minutes, your file naming needs work.
  4. Change one ingredient (swap butter for a dairy-free spread) and check that the matrix row updates, and that a CHECK appears if the new item isn't in the master list yet.

When the matrix said "N" and a customer reacted

Here is a realistic failure, described as an illustration. A producer's matrix listed the curry sauce as free from celery because the stock cubes' headline description did not mention it. The full specification, never requested, listed celery extract inside a spice blend. The AI draft had marked celery "not stated", and a tired editor changed "not stated" to N to clear the CHECK count.

Two controls prevent that. First, N is allowed only when a specification covers the allergen explicitly, so the "checked by" column must carry a document reference for every N. Second, the person signing off samples N cells and asks to see the document for each. The matrix you can defend is the one where every cell has its source.

Keeping the template alive

  • Recipe change: update the recipe lines first, then see whether any CHECK appears.
  • New supplier or product code: add it to the master list at CHECK, request the spec, only then fill the cells.
  • Quarterly: run the spec comparison prompt on every specification that has changed, re-sign.
  • New starter: have them trace one ingredient end to end as part of training.

A chatbot can speed up the drafting, comparison and question-writing steps, but the evidence and the accountability stay human. For the wider question of whether a chatbot should answer customers' allergen questions at all, read the restaurant version of that decision.

Questions food makers ask about AI and allergen matrices

Can I rely on ChatGPT or Claude for allergen information?

Not on its own. A chatbot can propose which allergens an ingredient usually contains, but your supplier's specification for the exact product you buy is the evidence. Use AI to draft and to compare documents, and have a trained person confirm every row before the matrix is used.

Should the matrix cover the recipe or the finished product?

Build it per recipe from ingredient level, then check each finished product's label against it. Compound ingredients such as sauces, spice blends and chocolate chips carry their own allergens, so a recipe line that reads only 'sauce' hides the real answer.

How do I handle cross-contact in the matrix?

Keep it in a separate set of columns from the recipe allergens. Record the shared equipment, line or room, the cleaning method and who decided whether a precautionary statement is needed. That decision is a risk assessment for a person, not a chatbot output.

How often should the matrix be reviewed?

Whenever a recipe, ingredient, supplier or production line changes, and on a fixed schedule such as every quarter. Supplier specifications change without a loud announcement, so ask suppliers to notify you and compare each new spec to the old one.

What if a supplier does not send a specification?

Treat the ingredient as unconfirmed. Mark it 'CHECK' in the matrix, do not release recipes that use it with a free-from claim, and ask the supplier again in writing. A missing answer is never the same as an allergen-free answer.

Further reads

Sources: the 14-allergen annex of food-information law (allergen names, the cereals and nuts it lists, the sulphite threshold) on an official legislation site, and a food regulator's major-allergen page for comparison, both checked November 2026; check the list your own regulator publishes.

Want your allergen records set up so they stay current?

On a 1:1 call we'll look at how recipes, supplier specs and labels are kept today, and decide which steps a spreadsheet and an AI check can take on.

Book a 1:1 call with me