CalculatorsToolsGuides 日本語
BenchFig › Guides › How to do a t test: Student’s, Welch’s and paired, with Excel
Statistics

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.

Updated: BenchFig日本語
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 dataTestExample
Two independent groups (unpaired)Welch’s t test (no equal-variance assumption). Student’s t test assumes equal variancesWild-type vs knockout mice, control vs treated cells
The same subjects measured twice (paired)Paired t testBefore vs after, left vs right, experiments run side by side on the same day
Three or more groupsNot repeated t tests: ANOVA with multiple comparisonsControl and three doses
Key points
  • 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.

Made-up example values.
GroupnValuesMeanSD
Control64.2, 5.1, 3.8, 4.6, 5.4, 4.44.5830.588
Treated65.9, 7.8, 5.2, 8.6, 6.4, 7.16.8331.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.

sp = √(n1 − 1)s12 + (n2 − 1)s22n1 + n2 − 2 = 0.979  SE = sp√(1/n1 + 1/n2) = 0.565

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.

SE = √(s12/n1 + s22/n2)  df = (s12/n1 + s22/n2)2(s12/n1)2/(n1 − 1) + (s22/n2)2/(n2 − 1)Welch–Satterthwaite degrees of freedom (usually not a whole number).

3. t and P

t = difference ÷ SE = 2.25 ÷ 0.565 = 3.98, compared with the t distribution on the given df (two-tailed).

BenchFig’s results match SciPy (scipy.stats.ttest_ind).
dftP (two-tailed)95% CI of difference
Student’s t test103.980.00260.99 to 3.51
Welch’s t test7.103.980.00520.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).

0246810ControlTreatedExpression (a.u.)**
Example data (made up, n = 6 each). Bars = mean, dots = samples, error bars = SD. ** = Welch’s t test, P = 0.0052 (P < 0.01). The treated group is more variable (SD 1.25 vs 0.59).

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.

Made-up example values.
12345678
Before132145128151139142136148
After124139125140133138131139
Diff863116459
t = mean differenceSD of differences ÷ √n = 6.502.673 ÷ √8 = 6.88  df = n − 1 = 7

Result: t(7) = 6.88, P = 0.00024; 95% CI of the difference 4.27 to 8.73 mmHg.

What if you ignore the pairing? The same numbers in an unpaired t test give t(14) = 1.80, P = 0.094: not significant. Differences between people (128 to 151) are large and hide the effect. The paired test uses within-person differences, which cancel them out.

How to do a t test in Excel

Excel’s T.TEST function (older versions: TTEST) returns the P value.

=T.TEST(array1, array2, tails, type)
ArgumentValueMeaning
tails2Two-tailed (the usual choice). 1 = one-tailed
type1Paired t test
2Two-sample, equal variance (Student’s t test)
3Two-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:

Paste from Excel: t test and graph in one stepPaste your columns and get Welch’s, Student’s or paired t tests, a bar-and-dot graph, and significance brackets with asterisks placed automatically. No sign-up, runs in the browser.
Open for free →

How to report it

Give the test name, t, df and P, plus mean ± SD (or the difference with its 95% CI) and n.

Expression was higher in treated (6.83 ± 1.25) than control samples (4.58 ± 0.59; Welch’s t test, t(7.10) = 3.98, P = 0.0052; difference 2.25 [95% CI 0.92 to 3.58]; n = 6 per group).

More formatting rules: how to report statistics.

Assumptions and common mistakes

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.

Run a t test on sample dataPaste numbers into the graph screen and choose Welch’s or Student’s t test, or “Match by row” for paired data. The P value, the asterisks on the graph and the results sentence appear immediately.
Open for free →
Your own data, all the way to the final figure.Loading your files, saving, and journal-ready export (PDF, TIFF, PNG, SVG) are in BenchFig Pro for Windows, updated based on researchers’ requests: ¥3,980/year (2 PCs), with lab and perpetual licenses too.
About the app →

Related guides

Microsoft Excel is a trademark of Microsoft Corporation. Product and journal names are trademarks or registered trademarks of their respective owners.