← All resources

Qualitative Data Coding Example: Types and Worked Samples

14 min read
Qualitative Data Coding Example: Types and Worked Samples

A qualitative data coding example is easiest to see in one sentence. A nurse says, "I write everything on a sheet of paper in my pocket because I don't trust the system to show me what she told me." You label that passage "keeping personal notes" and "distrust of system." Qualitative data coding is that act of labeling, repeated across every transcript, survey response, or set of field notes until patterns become visible.

This guide follows one small study from raw excerpts to finished themes. You will see a first pass of codes, line-by-line refinement, seven coding methods applied to the same sentence, the difference between deductive and inductive coding, a codebook entry, and the tools you can use, including AI.

All excerpts are illustrative text written for this article, so you can copy the method without touching anyone's real data. Many research projects pair interviews with numeric data, and PlotStudio AI is built for that numeric side, so this guide stays on the coding method itself.

Why qualitative data coding matters

Coding matters because it turns a pile of words into material you can search, compare, and defend. Without it, your findings rest on the quotes you happen to remember. With it, every claim traces back to specific passages.

What coding does for your analysis

Coding gives you retrieval, comparison, and a paper trail. Once every passage about "keeping personal notes" carries the same label, you can pull all of them in seconds. You can see which participants said it and check whether you have a pattern or one loud voice.

It also protects you against selective reading. People remember vivid quotes and forget quiet, repeated ones. Coding forces you to give each passage the same attention. The codes and their definitions then let a reviewer, co-author, or thesis committee see how you moved from transcripts to conclusions.

Coding is what turns "I read the transcripts" into "here is how I reached this finding."

What counts as qualitative data

Any non-numerical material that carries meaning can be coded. The most common sources are:

  • Interview transcripts, from semi-structured or in-depth interviews
  • Focus group recordings and transcripts
  • Open-ended survey responses
  • Field notes from observation
  • Documents such as policies, clinical notes, or emails
  • Photographs, video, and diary entries

Text is the easiest to code, so audio and video are usually transcribed first. Images can be coded directly with short descriptive labels. Whatever the source, the same logic applies: read, label, compare, group.

How to code qualitative data, step by step

You code qualitative data in five moves: read everything, assign first-pass codes, refine line by line, group codes into categories, and write themes. This section works through the first three on a small study. Later sections cover grouping and theme writing.

A five-step process showing how to move from reading transcripts to writing themes.

The example study and its excerpts

The research question is: how do nurses on a medical-surgical unit experience shift handover? You interviewed four nurses. Here are one illustrative excerpt from each:

  • P1: "Handover is supposed to take ten minutes, but if the previous nurse is rushed I just get a list of tasks. I end up piecing together the patient's story from the chart myself."
  • P2: "I write everything on a sheet of paper in my pocket because I don't trust the system to show me what she told me. Then I double check with the aide."
  • P3: "Honestly, I feel anxious walking into a shift when I only got half the picture. One night I found out about a fall risk an hour in."
  • P4: "When the charge nurse sits in on handover it just works. Everyone listens, nobody's looking at the door."

Read all four before you code anything. You are looking for what each speaker is doing, feeling, or assuming, not for the topic. Every excerpt is about handover, so "handover" would be a useless code.

Step 1: first-pass coding

In the first pass you attach short, tentative labels to meaningful chunks. Speed matters more than polish here. You will rename and merge codes later.

Excerpt chunk Initial code
"I just get a list of tasks" (P1) Task-list handover
"piecing together the patient's story from the chart myself" (P1) Reconstructing patient story
"I write everything on a sheet of paper" (P2) Keeping personal notes
"I don't trust the system" (P2) Distrust of system
"double check with the aide" (P2) Verifying with colleagues
"I feel anxious walking into a shift" (P3) Anxiety
"found out about a fall risk an hour in" (P3) Late discovery of risk
"charge nurse sits in on handover" (P4) Charge nurse presence
"Everyone listens, nobody's looking at the door" (P4) Focused attention

That is nine codes from four short excerpts. A real transcript set produces far more, and that is normal. A chunk can carry more than one code, and a code can be reused whenever another participant says something similar.

Step 2: line-by-line coding and refinement

Line-by-line coding means rereading each sentence and splitting broad codes into more precise ones. "Task-list handover" in P1 hides two ideas. One is the outgoing nurse being rushed, and the other is receiving tasks instead of a patient story. You add "Rushed outgoing nurse" and keep "Task-list handover" for the second. P3's fall risk also deserves its own code, "Fall risk missed," because it is a concrete safety event, not just a feeling.

The second pass also works in the other direction. If two codes turn out to say the same thing, merge them and record the merge. Write a short memo whenever you notice something. For example: "P2 and P3 both act around the system, possibly a trust issue, check other transcripts." Memos cost a minute and save you from forgetting why a code exists.

Your first codes should be rough and fast. Precision comes in the second pass, not the first.

Qualitative coding examples by method

Coding methods differ in what they capture: a topic, a quote, an action, a feeling, or a belief. The same sentence yields a different code under each method, which is why choosing a method is a research decision, not a formatting choice.

One sentence, seven coding methods

Here is P3's sentence, "Honestly, I feel anxious walking into a shift when I only got half the picture," coded seven ways.

Method What it captures Code for this sentence
Descriptive The topic, as a word or noun Shift start
In vivo The participant's own words "half the picture"
Process An action, usually ending in -ing Starting shift with incomplete information
Emotion The feeling expressed Anxiety
Values Beliefs, attitudes, priorities Valuing complete information
Structural The question or section the passage answers Q3: feelings about handover
Simultaneous Several codes on one passage Anxiety + "half the picture"

Notice that none of these codes is wrong. They answer different questions about the same passage.

How to choose a method

Match the method to your research question. If you study experiences and meaning, in vivo and emotion codes keep you close to participants. If you study procedures, such as handover, process codes show what people do. If you study beliefs or culture, values coding fits.

For large datasets, structural or descriptive coding helps you navigate. Most researchers combine methods. A common pairing is structural coding first, tagging each answer with the interview question, then in vivo or process coding inside each tag.

Coding open-ended survey responses

Survey responses are shorter than interview answers, so they usually take one or two codes each. Suppose the survey asked, "What one change would improve handover on your unit?"

Response Codes
"Give us ten minutes with no phone calls before shift starts." Protected time; Interruptions
"A standard template so nobody skips the risk section." Standard template; Risk information
"Honestly, just have the charge nurse in the room." Charge nurse presence

The third code was reused from the interviews, which is the point. Reusing codes across data sources lets you compare what interviewees and survey respondents say. With hundreds of responses, put one response per spreadsheet row and code in an adjacent column.

The method you pick decides what you notice, so pick it from your research question, not from habit.

Deductive, inductive, and hybrid coding compared

Deductive coding starts with codes you define in advance, inductive coding builds codes from the data, and hybrid coding does both. The choice depends on how much you already know about your topic and what you need to produce.

How the three approaches differ

Approach Where codes come from Handover example Main risk
Deductive A framework, prior literature, or your research questions Start with "Information completeness," "Interruptions," and "Communication tools" Missing what you did not expect
Inductive The data itself "Pocket sheet" emerges from P2 and becomes a code Slow, and codes can sprawl
Hybrid Both Start with the three framework codes, then add "Keeping personal notes" Needs rules for when new codes are allowed

The deductive route is faster because your lens is narrow. The inductive route is slower but catches things your framework never mentioned.

Which one to choose

Choose deductive coding when you are evaluating something against known criteria or testing an existing framework. A program evaluation with fixed questions is a typical case. Choose inductive coding when the topic is poorly understood or you want to build theory, because starting with fixed codes would blind you to what participants actually say.

In practice, hybrid coding is the common answer. In the handover study, a framework code like "Interruptions" would cover P4's "nobody's looking at the door," while P2's pocket sheet would never appear in a framework and needs a new code. Record in your codebook which codes were set in advance and which emerged, so a reader can see how much of your analysis the data drove.

If you can name your codes before reading the data, you are coding deductively. If you cannot, you are coding inductively.

From codes to categories to themes

A category groups related codes under a label, and a theme is a statement of meaning that explains a pattern across categories. Coding is not finished when you have a long list of codes. The list only becomes findings when you organize it.

Grouping codes into categories

Look for codes that describe the same kind of thing. Here are the nine codes from the first pass, grouped.

Index cards sorted into four piles on a desk next to a pencil and paper clips.

Code Category
Task-list handover Information gaps
Reconstructing patient story Information gaps
Late discovery of risk Information gaps
Keeping personal notes Workarounds
Distrust of system Workarounds
Verifying with colleagues Workarounds
Anxiety Emotional cost
Charge nurse presence Enabling conditions
Focused attention Enabling conditions

That is three codes in information gaps, three in workarounds, one in emotional cost, and two in enabling conditions, which adds up to the nine codes. In a larger study you would expect the category count to stay small while the code count falls through merging. Organize categories in a hierarchy if it helps, with parent categories like "Workarounds" and child codes beneath them.

Writing the theme

A category is a label. A theme makes a claim. "Workarounds" is a category. "Nurses compensate for incomplete handover with personal workarounds, and visible leadership presence reduces the need for them" is a theme. If you can swap your theme for a one-word topic and lose nothing, it is not yet a theme.

P4 shows why you should not treat outliers as noise. Her description of a smooth handover is a contrast case. It points to conditions under which the problem disappears. Four interviews cannot support a real conclusion, of course. A real study would check the theme against every transcript and look for cases that contradict it before treating it as a finding.

Categories tell you what the data is about. Themes tell you what the data means.

A sample codebook and common coding mistakes

A codebook is the document that defines every code so that you, and anyone else on your team, apply it the same way. It matters most in deductive and hybrid coding, but even inductive projects need one by the end.

A sample codebook entry

Field Entry
Code name Keeping personal notes
Category Workarounds
Definition The participant records patient information outside the official system
Include when Paper sheets, phone notes, hand-written lists
Exclude when Charting in the electronic record, which is routine documentation
Example "I write everything on a sheet of paper in my pocket."
Origin Emerged from P2 during the first pass

The "exclude when" field does most of the work. It stops a code from swallowing neighboring ideas.

Mistakes that weaken coding

Most coding problems come from the same few habits:

  • Topic-only codes. "Handover" tells you nothing. Code what the participant says about it.
  • Synonym codes. "Anxiety," "nervousness," and "worry" as three codes will split your evidence. Pick one and define it.
  • Code sprawl. If you cannot explain in a sentence how two codes differ, merge them.
  • Directional drift. Your use of a code shifts across weeks. Reread the definition and recode early transcripts when it happens.
  • No memos. You will not remember why you merged two codes in month three.

Checking consistency

If you work with a team, have a second person code a sample of transcripts independently and compare. Some projects report an agreement statistic such as Cohen's kappa, which adjusts for chance agreement. Other approaches, notably reflexive thematic analysis, treat the researcher's interpretation as part of the method and do not use it. Whichever applies to you, discussing disagreements until the definitions are clear improves the codebook.

Tools for coding, including AI

You can code with anything from highlighters to dedicated software, and the right tool depends on how much data you have and whether you work alone. Start with the simplest tool that lets you retrieve all passages under a code.

Pick a tool by project size

Tool Good for Limit
Paper and highlighters A handful of short transcripts Hard to search or share
Word or Google Docs comments One researcher, a few transcripts No retrieval across documents
Excel or Google Sheets Open-ended survey responses, one per row Long transcripts are awkward
Dedicated software such as NVivo, ATLAS.ti, or MAXQDA Large projects and teams Learning curve and licence cost

Highlighters, a printed transcript, and a laptop with a spreadsheet next to sticky notes.

Can ChatGPT do qualitative coding?

It can help, within limits. A general-purpose AI model can draft candidate codes from a few transcripts and apply an existing codebook to a large set of responses. Treat its output as a first draft. Check every code against the original passage, because models can invent plausible labels that the text does not support.

The interpretation stays yours. Deciding what a pocket sheet means is the research. Also check privacy rules first. Interview transcripts can be identifiable, and your ethics approval or institution may restrict sending them to outside services.

Let AI propose codes if you like, but never let it decide what your participants meant.

Start with one transcript

Qualitative data coding is a sequence you can repeat: read, label tentatively, refine line by line, merge, group into categories, and write themes that make a claim. The handover example showed the whole path in miniature. Nine rough codes became four categories and one defensible theme, and the codebook recorded every decision along the way.

Your best next step is small. Pick one transcript, choose one coding method that fits your research question, and code it in a spreadsheet or document with a memo beside each surprising passage. Then write the codebook entry for your first three codes before moving on.

If your study also includes numeric data, such as survey scales or outcome measures, you can analyze the numeric side of your research in PlotStudio AI while you keep your coding workflow for the interviews.