When you collect survey responses (paper-based or online), you’ll often have text answers (“Strongly Agree”, “Male”, “Bachelor’s degree”) that aren’t ready for analysis. Coding transforms these into numbers or standardized categories that Excel (or SPSS, R, Python, etc.) can process.


Step 1: Set Up Your Spreadsheet

  1. Open Excel.
  2. Put questions as column headers (Q1, Q2, Q3, or short labels).
  3. Put each respondent as a row.

Example:

IDGenderQ1_SatisfactionQ2_FrequencyQ3_Comments
1MaleAgreeWeeklyGood service
2FemaleStrongly AgreeDailyToo crowded

Step 2: Decide Coding Rules

For each type of question, assign numbers to responses.

  1. Nominal (categories, no order)
    • Example: Gender
      • Male = 1, Female = 2, Other = 3
  2. Ordinal (ranked, Likert scales)
    • Example: Satisfaction (Strongly Disagree → Strongly Agree)
      • Strongly Disagree = 1
      • Disagree = 2
      • Neutral = 3
      • Agree = 4
      • Strongly Agree = 5
  3. Interval/Ratio (numeric answers)
    • Example: Age, Income → keep as numbers.
  4. Multiple-response (check-all-that-apply)
    • Code each option in a separate column with 1 = selected, 0 = not selected.
    • Example: “Which apps do you use?” RespondentFacebookInstagramTikTok11012011

Step 3: Apply the Coding in Excel

You can:

  • Manually replace text answers with numbers.
  • Or use Excel’s Find & Replace (Ctrl+H) to swap quickly.
  • Or use formulas like:
=IF(B2="Male",1,IF(B2="Female",2,3))

(This would code Male = 1, Female = 2, Other = 3.)


Step 4: Keep a Codebook

Always create a separate sheet in your Excel file as a codebook:

VariableQuestionCoding Rules
GenderWhat is your gender?1 = Male, 2 = Female, 3 = Other
Q1I am satisfied with the service (Likert)1 = Strongly Disagree … 5 = Strongly Agree
AppsWhich apps do you use?1 = Selected, 0 = Not selected

This ensures transparency and reproducibility.


Step 5: Test and Clean Your Data

  • Check for missing values (leave blank or code as 99/NA depending on your analysis tool).
  • Ensure consistency (e.g., no mix of “Male” and “male”).
  • Verify by running quick counts using =COUNTIF() for each code.

Final Thoughts

Coding a questionnaire in Excel is all about:

  1. Structuring your sheet properly (respondents in rows, questions in columns).
  2. Converting text into numbers using clear rules.
  3. Keeping a codebook for reference.
  4. Using formulas or find/replace to speed things up.

Once coded, your dataset is ready for analysis (descriptive stats, charts, regression, factor analysis—you name it).


Dr Benhima

Dr Benhima is a researcher and data analyst.

Author posts

Basic

30 min consultation
$25per 30 min
  • Data checks
  • Analysis plan
  • Analysis templates

Premium

90 min consultation
$75per 90 min
  • Descriptive statistics
  • Inferential statistics
  • Hypothesis testing

Privacy Preference Center