Does More Sleep Go With Higher Midterm Scores? An Excel Walkthrough
First-year Psychology research methods · Excel (Microsoft 365) · 86 anonymised survey rows
1. The question, made measurable
Question: Do students who sleep more score higher on the statistics midterm?
Measurable version: Compare average MidtermScore across sleep bands (under 6, 6 to under 8, 8+ hours), and measure the strength of the linear relationship between SleepHours and MidtermScore with a correlation coefficient.
Your columns: A StudentID · B SleepHours · C StudyHours · D MidtermScore · E Year
2. Check and clean the data first
| Check | How in Excel | What to do if it fails |
|---|---|---|
| Blanks | =COUNTBLANK(B2:D87) | Decide: remove the row or leave it out of that calculation (write down which) |
| Duplicates | Select A2:A87 → Home → Conditional Formatting → Highlight Duplicate Values | Keep one row per StudentID |
| Impossible values | =COUNTIFS(B2:B87,"<3")+COUNTIFS(B2:B87,">13") and =COUNTIFS(D2:D87,">100") | Check the original survey; fix typos or exclude |
| Numbers stored as text | =SUMPRODUCT(--ISTEXT(B2:D87)) should be 0 | Data → Text to Columns → Finish |
Tip: turn the data into a table first (click any cell → Ctrl+T, tick "My table has headers"). Formulas then use names like Table1[SleepHours] and grow automatically if you add rows.
3. Step-by-step formulas
Step 1 — Add a sleep band column (F). In F1 type SleepBand, then in F2:
=IFS(B2<6, "Under 6", B2<8, "6 to under 8", TRUE, "8+")What it does: checks each condition in order and labels the student's band.
Step 2 — Average score per band. Put the band names in H2:H4 and in I2:
=AVERAGEIFS($D$2:$D$87, $F$2:$F$87, H2)What it does: averages column D only for rows whose band matches H2. The $ signs lock the ranges so you can copy the formula down.
Step 3 — How many students in each band. In J2:
=COUNTIFS($F$2:$F$87, H2)Why it matters: an average from 6 students is far less reliable than one from 40.
Step 4 — Correlation between sleep and score.
=CORREL(B2:B87, D2:D87)What it does: gives a number from −1 to 1. Near 0 = no linear relationship; 0.3 = weak to moderate positive; 0.7+ = strong positive.
Step 5 — Pivot table (same answer, no formulas). Insert → PivotTable → New sheet. Drag SleepBand to Rows, MidtermScore to Values, then click it → Value Field Settings → Average. Drag MidtermScore to Values again and set it to Count.
Step 6 — Scatter chart. Select B1:B87 and D1:D87 → Insert → Scatter. Then Chart Elements (+) → Trendline → More options → tick Display R-squared value on chart.
4. What your output should look like
Example shape only — your numbers will differ. [run to check]
| SleepBand | Average MidtermScore | Students |
|---|---|---|
| Under 6 | [run to check] | [run to check] |
| 6 to under 8 | [run to check] | [run to check] |
| 8+ | [run to check] | [run to check] |
Correlation (CORREL): [run to check]
5. How to interpret it — and its limits
- If the averages rise from "Under 6" to "8+" and CORREL is positive, students who sleep more tend to score higher in this sample.
- Correlation is not causation. Students who sleep more may also study more or have fewer jobs. Check
=CORREL(B2:B87, C2:C87): if sleep and study hours are linked, study time could explain part of the pattern. - Self-reported sleep is an estimate; people often overestimate it.
- One class, 86 students is a small sample; do not generalise to all students.
Model sentence for your report: "In our class sample (n = 86), students reporting more sleep tended to have higher midterm scores (r = [your value]); however, this is correlational and may reflect other factors such as study time."
6. Common errors
#DIV/0!in AVERAGEIFS → no students in that band; check the band labels match exactly (including spaces).- CORREL returns
#N/A→ ranges are different sizes; both must be rows 2 to 87. - Pivot shows Sum instead of Average → change it in Value Field Settings.
7. Practice tasks
- Repeat Step 2 for Year (1 vs 2) instead of sleep band. Is there a difference?
- Compare sleep bands only for students who study 5–10 hours a week. Hint: add a condition to AVERAGEIFS:
$C$2:$C$87, ">=5", $C$2:$C$87, "<=10".
Next step: paste your band averages and CORREL value, and I'll check them with you. Which step was the hardest?