Topic 1 of 4 · 4 min read
Building a theme codebook
Goal: Build a codebook of five to ten themes with definitions, include and exclude rules and an example quote each.
A codebook is a short table that defines every theme, says what counts and what does not, and gives one real quote, so that anyone, human or AI, labels a response the same way.
Check yourself · 1 of 3
Which part of a codebook row stops two similar themes from claiming the same comment?
Why it matters
If you paste 400 survey answers into ChatGPT, Claude or Gemini and ask "what are the themes?", you get a list that sounds sensible and changes every time you ask. The names drift. "Slow" turns into "performance" in one run and "waiting time" in the next. You cannot count themes that keep changing shape. A codebook fixes the labels before any counting starts. This is the same idea researchers call thematic analysis: read, name patterns, define them, then code.
How to do it
- Take a sample. Pick 40 to 60 responses at random, not the first 40. The first rows are often from one week or one customer type.
- Ask for draft themes. Give the model the sample and ask for 5 to 10 themes, each with a short name and a one-line definition. Tell it to quote each theme from the sample, word for word.
- Add include and exclude rules. For each theme, write what belongs and what looks similar but belongs elsewhere. The exclude rule is the one that stops overlap.
- Add an "Other" and an "Unclear" label. Without them, the model forces every odd answer into a theme.
- Read it yourself. Merge themes that you could not tell apart, split any that hold two problems, and rewrite names in the customers' own words.
- Freeze it. Give the table a version, such as "codebook v1", and do not change it while coding. If you must change it, note it as v2 and recode everything.
Before and after
Before: "Find the main themes in these 400 comments."
The model invents its own labels each time, merges unrelated complaints and gives no rule for borderline cases.
After: A table with these columns: theme, definition, include, exclude, example quote. One row reads: Theme "Slow checkout". Include: waiting on payment or page loading at checkout. Exclude: slow delivery after the order, which is "Late delivery". Example: "The pay button spun for a full minute."
Now a second person, or a second model, can check any response against the rules.
What goes wrong
- Themes built from one angry comment. A theme needs several responses behind it. Keep a rare but serious issue, such as a safety complaint, as its own flagged label.
- Overlapping themes. "Pricing" and "Value for money" will both claim the same comments unless the exclude rules say who wins.
- Quotes that were tidied. Models often fix spelling and grammar in the example quote. Check each example against the raw text.
- Changing the codebook midway. Counts from two versions cannot be added together.
Examples
One codebook row
| Theme | Definition | Include | Exclude | Example quote |
|---|---|---|---|---|
| Confusing setup | Trouble finishing first-time setup | Cannot find a step, unclear instructions | Bugs that crash setup (use "Crashes") | "I did not know which email to use for the invite." |
Every row answers four questions: what is it, what counts, what does not, and what does it sound like.
Reading draft themes critically
The model proposes "User experience" and "Usability" as two themes. Read their definitions: if both say "hard to use the app", they are one theme. Merge them, then write an exclude rule so "Slow checkout" stays separate.
Key points
- A codebook lists each theme with a definition, include rules, exclude rules and one real example quote.
- Draft themes from a random sample of 40 to 60 responses, not from the first rows of the file.
- Exclude rules matter most, because they decide which theme wins when two seem to fit.
- Add Other and Unclear labels so odd answers are not forced into a theme.
- Freeze the codebook with a version name before coding, and recode everything if you change it.
Common mistakes
- Asking for themes on the full file in one go, then using whatever labels come back.
- Writing themes without exclude rules, so responses fit two themes at once.
- Accepting example quotes without checking them against the raw responses.
- Editing the codebook after coding has started and mixing the counts.
Check yourself · 2 of 3
Why take a random sample of 40 to 60 responses to draft themes, rather than the first 40 rows?
Check yourself · 3 of 3
After coding 150 responses, you notice a new theme and add it to the codebook. What should you do next?
Practice items, not counted towards your mastery.
Start here
- How to analyze qualitative data from UX research: thematic analysis (NN/g) (opens in a new tab)ArticleFree
Step-by-step thematic analysis: how researchers code, group codes into themes and check them.
- Clio: privacy-preserving insights into real-world AI use (Anthropic) (opens in a new tab)PaperFree
Shows how an AI lab groups huge volumes of text into themes while removing private details first.
- COPILOT function (Excel) (opens in a new tab)DocsFree
Microsoft's page on the in-cell COPILOT function, withdrawn on 14 September 2026, and what happens to labels it already wrote.
Where to go in your country
- GDPR.eu (opens in a new tab)ArticleFreeEU
Plain-language entry point to EU personal-data rules that apply to names and emails inside feedback.