Install free

Guides

How to do a t-test in Google Sheets

A t-test compares two means. Which version you need depends on how the data was collected.

SituationTestT.TEST type
The same people measured twice (before and after)Paired Two Sample for Means1
Two separate groups, similar spreadTwo-Sample Assuming Equal Variances2
Two separate groups, different spreadTwo-Sample Assuming Unequal Variances (Welch)3

Paired example

Ten students took a test with Method A and later with Method B.

AB
1Method AMethod B
27871
38579
46965
59184
67470
78876
88273
97769
108075
118678

In StatPak choose t-Test: Paired Two Sample for Means, set Variable 1 to A1:A11, Variable 2 to B1:B11, tick Labels and click Run.

t-Test: Paired Two Sample for Means
Method AMethod B
Mean8174
Variance45.5555630.88889
Observations1010
Pearson Correlation0.9389553
Hypothesized Mean Difference0
df9
t Stat9.036961
P(T<=t) one-tail4.1282E-6
t Critical one-tail1.833113
P(T<=t) two-tail8.2564E-6
t Critical two-tail2.262157

P(T<=t) two-tail is 8.2564E-6, far below 0.05, so the average score changed between methods. The same p-value comes from =T.TEST(A2:A11, B2:B11, 2, 1).

Two independent groups

Comparing Method A with a separate group taught with Method C, assuming equal variances:

t-Test: Two-Sample Assuming Equal Variances
Method AMethod C
Mean8165
Variance45.5555621.11111
Observations1010
Pooled Variance33.33333
Hypothesized Mean Difference0
df18
t Stat6.196773
P(T<=t) one-tail3.7754E-6
t Critical one-tail1.734064
P(T<=t) two-tail7.5509E-6
t Critical two-tail2.100922

With unequal variances (Welch's test), the degrees of freedom change. Excel's ToolPak rounds Welch's degrees of freedom to a whole number, and StatPak does the same so results match course answer keys: here df is 16 and the two-tail p-value is 1.2803E-5. =T.TEST(A2:A11, C2:C11, 2, 3) uses the unrounded value, so it can differ slightly in later digits.

One tail or two?

Use the two-tail p-value unless you decided before looking at the data that only one direction matters. The one-tail p-value is half the two-tail value when the difference goes in the predicted direction.

Related guides