How to Do a t-Test in Google Sheets (Paired and Two-Sample)
Google Sheets has T.TEST, but it returns only a p-value. To report a t-test you usually also need the means, variances, degrees of freedom, the t statistic and the critical value. SheetStats builds the full table, laid out like Excel's Data Analysis ToolPak.
Which t-test?
| Tool | Use it when |
|---|---|
| t-Test Paired | The same people or items are measured twice (before and after, left and right). |
| t-Test Equal Variances | Two separate groups whose spreads are about the same. |
| t-Test Unequal Variances | Two separate groups whose spreads may differ (Welch's test). The safe default for independent groups. |
Steps
- Install SheetStats (button below).
- Go to Extensions → SheetStats → Data Analysis and pick the t-test.
- Select Variable 1 range and Variable 2 range (one column each). Tick Labels in first row if row 1 has names.
- Leave Hypothesized mean difference at 0 and Alpha at 0.05 unless you need otherwise, then click Run.
Example: paired test, before and after training
Eight people's scores before (76.5 average) and after (80.4 average) a training course:
| Before | After | |
|---|---|---|
| Mean | 76.5 | 80.375 |
| Observations | 8 | 8 |
| df | 7 | |
| t Stat | -6.347 | |
| P(T<=t) two-tail | 0.00039 | |
| t Critical two-tail | 2.365 |
The two-tail p-value is below 0.05 and |t Stat| is bigger than t Critical, so the average change is statistically significant. Use the one-tail values only if you decided before looking that you were testing one direction.
Free to install. Data Analysis, Goal Seek, Solver and Monte Carlo in one add-on.
Questions
Why does SheetStats give a different df than my textbook for Welch's test?
Excel rounds the Welch degrees of freedom to a whole number, and SheetStats does the same by default. Tick "Use exact (fractional) df" to use the unrounded value that R and most textbooks use.
Does it match Google Sheets' T.TEST function?
Yes. The p-values match T.TEST with the same tails and type, except Welch's test with rounded df, which matches Excel's ToolPak instead. Tick "Use exact (fractional) df" to match T.TEST type 3.
What if my two columns have different lengths?
That is fine for the two-sample tests. The paired test needs the same number of values in both columns.