How to do a t test: Student’s, Welch’s and paired, with Excel
The t test asks whether two group means differ. There are three versions (Student’s, Welch’s and paired), and the choice changes the P value. Here is each calculation with numbers you can check, how to do it in Excel, and how to report it.
Run a t test on your own dataPaste columns from Excel: P value, CI, effect size and a results sentence (Welch, Student, paired, Mann–Whitney).Calculate →Three t tests and how to choose
| Your data | Test | Example |
|---|---|---|
| Two independent groups (unpaired) | Welch’s t test (no equal-variance assumption). Student’s t test assumes equal variances | Wild-type vs knockout mice, control vs treated cells |
| The same subjects measured twice (paired) | Paired t test | Before vs after, left vs right, experiments run side by side on the same day |
| Three or more groups | Not repeated t tests: ANOVA with multiple comparisons | Control and three doses |
- Two independent groups: use Welch’s t test when in doubt
- Before/after on the same subjects: paired t test. Ignoring the pairing loses power
- n is the number of biological replicates (average technical replicates first)
- Many outliers or strongly skewed data: Mann–Whitney or Wilcoxon (nonparametric)
Unpaired t test: worked example
Expression of a gene in control and treated samples, six per group.
| Group | n | Values | Mean | SD |
|---|---|---|---|---|
| Control | 6 | 4.2, 5.1, 3.8, 4.6, 5.4, 4.4 | 4.583 | 0.588 |
| Treated | 6 | 5.9, 7.8, 5.2, 8.6, 6.4, 7.1 | 6.833 | 1.253 |
1. Difference between means
6.833 − 4.583 = 2.25.
2. Standard error of the difference
Student’s t test assumes equal variances and uses the pooled SD, sp.
Welch’s t test uses each group’s own variance. With equal n, the SE is identical (0.565); the difference is in the degrees of freedom.
3. t and P
t = difference ÷ SE = 2.25 ÷ 0.565 = 3.98, compared with the t distribution on the given df (two-tailed).
| df | t | P (two-tailed) | 95% CI of difference | |
|---|---|---|---|---|
| Student’s t test | 10 | 3.98 | 0.0026 | 0.99 to 3.51 |
| Welch’s t test | 7.10 | 3.98 | 0.0052 | 0.92 to 3.58 |
The treated SD is about twice the control SD. Welch reduces df from 10 to 7.10, and P rises from 0.0026 to 0.0052. With unequal spread, Student’s test can give a P value that is too small (worst when group sizes also differ, especially when the smaller group is the more variable one).
Effect size (Cohen’s d)
P values shrink as n grows, so also report the size of the difference: d = difference ÷ sp = 2.25 ÷ 0.979 ≈ 2.30 (0.8 or more is conventionally “large”; Cohen 1988).
Paired t test
Systolic blood pressure (mmHg) in the same 8 people before and after a drug. The paired t test takes each person’s difference (before − after) and tests whether the mean difference is zero, as a one-sample t test.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
|---|---|---|---|---|---|---|---|---|
| Before | 132 | 145 | 128 | 151 | 139 | 142 | 136 | 148 |
| After | 124 | 139 | 125 | 140 | 133 | 138 | 131 | 139 |
| Diff | 8 | 6 | 3 | 11 | 6 | 4 | 5 | 9 |
Result: t(7) = 6.88, P = 0.00024; 95% CI of the difference 4.27 to 8.73 mmHg.
How to do a t test in Excel
Excel’s T.TEST function (older versions: TTEST) returns the P value.
| Argument | Value | Meaning |
|---|---|---|
| tails | 2 | Two-tailed (the usual choice). 1 = one-tailed |
| type | 1 | Paired t test |
| 2 | Two-sample, equal variance (Student’s t test) | |
| 3 | Two-sample, unequal variance (Welch’s t test) |
With control in A2:A7 and treated in B2:B7, Welch’s test is =T.TEST(A2:A7, B2:B7, 2, 3), which returns 0.0052. Three things to watch:
- It returns only the P value, not t or df. For the full report, use Data → Data Analysis (Analysis ToolPak) → t-Test, or the formulas above (report Welch’s fractional df from the formula).
- For a paired test (type 1), the same row must be the same subject in both ranges.
- Excel has no built-in way to add significance brackets and asterisks; they are drawn by hand. Conventions are in significance asterisks on graphs.
How to report it
Give the test name, t, df and P, plus mean ± SD (or the difference with its 95% CI) and n.
More formatting rules: how to report statistics.
Assumptions and common mistakes
- Independence: each data point is independent. Counting technical replicates as n makes P too small (pseudoreplication).
- Normality: each group (or the paired differences) is roughly normal. With small n a test can hardly check this, so plot the points and look for extreme outliers or skew. Alternatives: Mann–Whitney U test, Wilcoxon signed-rank test. Caveats of normality tests: Shapiro–Wilk.
- “Not significant” is not “no difference”: with small n even large effects can miss significance. The confidence interval shows which differences remain plausible.
- Repeated t tests for 3+ groups: three t tests raise the chance of at least one false positive to up to about 14% (1 − 0.953). Use ANOVA with multiple comparisons.
Sources: Welch BL (1947) Biometrika 34:28–35; Delacre M, Lakens D, Leys C (2017) Int Rev Soc Psychol 30:92–101 (why Welch should be the default); Cohen J (1988) Statistical Power Analysis for the Behavioral Sciences, 2nd ed.; Microsoft Support, “T.TEST function”.
FAQ
Student or Welch: which should I use?
Welch. When the two SDs are equal, Welch gives almost the same answer as Student; when they differ, Student’s error rate drifts away from 5% (Delacre et al. 2017). State which one you used in the methods.
Should I use an F test or Levene’s test to choose between them?
No. Choosing the main test based on a preliminary test distorts the overall error rate. Using Welch from the start avoids the two-step procedure.
Can I run a t test with n = 3 per group?
Yes (df = 4), but power is low, only large differences reach significance, and normality cannot be checked. Show every point and report the effect size and confidence interval.
Can I use a one-tailed test?
Only if you decided before seeing the data that a difference in the other direction is impossible or irrelevant. Switching to one-tailed after looking halves the P value and doubles the error rate. Two-tailed tests are standard in the life sciences.
Can I run several t tests for three or more groups?
No. The chance of a false positive grows with every comparison. Use ANOVA followed by Tukey’s or Dunnett’s test.
Does Excel’s T.TEST return the t value?
No, it returns the P value. For t and the degrees of freedom, use the Analysis ToolPak t-test or the formulas above.
Related guides
Microsoft Excel is a trademark of Microsoft Corporation. Product and journal names are trademarks or registered trademarks of their respective owners.