How to Do a T-Test in Excel and Read the P-Value
By ExcelReady TeamUpdated 6 min read
The short answer
To do a t-test in Excel, type =T.TEST(array1, array2, tails, type), for example =T.TEST(B2:B8,C2:C8,2,3). Use 2 tails unless you fixed the direction in advance, and type 1 for paired data, 2 for equal variances or 3 for unequal variances. The result is the p-value: below 0.05 usually counts as statistically significant.
Key takeaways
- T.TEST returns a p-value, not the t statistic; the Analysis ToolPak shows both.
- Use type 1 for paired data (the same people measured twice) and type 3 for two separate groups when unsure.
- Use two tails unless you chose one direction before you saw the data.
- A p-value is how surprising your difference would be if the true averages were equal. It is not the chance the result is a fluke.
- Always report the averages and their difference next to the p-value.
On this page+
A t-test in Excel tells you whether the difference between two averages is bigger than you'd expect from random variation alone. You can run one with a single formula, T.TEST, or with the Analysis ToolPak, and both give you a p-value. This guide shows both methods on one small example, explains how to choose the tails and type, and shows how to read the p-value without overstating it.
What does a t-test tell you?#
A t-test compares the averages of two sets of numbers and asks: if there were really no difference between the groups, how unusual would a gap this big be? The answer comes as a p-value, a number between 0 and 1. A small p-value means the gap would be unusual if the groups were truly the same.
Here is the example used throughout. Seven learners were taught with Method A and seven different learners with Method B, then all took the same quiz:
| A | B | C | |
|---|---|---|---|
| 1 | Learner | Method A | Method B |
| 2 | 1 | 68 | 74 |
| 3 | 2 | 72 | 79 |
| 4 | 3 | 75 | 72 |
| 5 | 4 | 70 | 81 |
| 6 | 5 | 66 | 77 |
| 7 | 6 | 74 | 76 |
| 8 | 7 | 71 | 80 |
Start with the plain numbers. =AVERAGE(B2:B8) gives 70.86 and =AVERAGE(C2:C8) gives 77.00, so Method B scored about 6.1 points higher. The AVERAGE function guide covers the basics, and the average, min and max lesson practises them. The medians, 71 and 77, tell the same story, so no single extreme score is pulling the averages. The guide to average vs median explains why that check matters.
How to use the T.TEST function#
T.TEST takes the two ranges plus two settings and returns the p-value directly:
=T.TEST(array1, array2, tails, type)| Argument | What it means | Example |
|---|---|---|
| array1 | First group's numbers | B2:B8 |
| array2 | Second group's numbers | C2:C8 |
| tails | 1 for a one-tailed test, 2 for two-tailed | 2 |
| type | 1 paired, 2 two-sample equal variance, 3 two-sample unequal variance | 3 |
For the quiz data:
=T.TEST(B2:B8,C2:C8,2,3)The result is about 0.0039. With type 2 instead of 3, the answer is almost identical here, because the two groups spread out by a similar amount (standard deviations of about 3.2 and 3.3).
T.TEST works in Excel 2010 and later, including Microsoft 365 and Excel for Mac. Older files may use TTEST, which takes the same arguments and gives the same result.
How to choose the tails and type#
The tails and type settings change the answer, so choose them for the design of your study, not for the result you hope to get.
Tails. Use 2 in almost every case. A two-tailed test asks "are the averages different in either direction?" Use 1 only if you decided before collecting data that only one direction mattered. A one-tailed p-value is half the two-tailed one (about 0.0020 here), so picking it after seeing the data makes weak evidence look stronger.
Type. Match it to how the data was collected:
- Type 1, paired. The same people or items measured twice, such as each learner before and after training. Each row must belong together, and both ranges need the same number of values or T.TEST returns #N/A.
- Type 2, equal variance. Two separate groups that you have good reason to believe vary by the same amount.
- Type 3, unequal variance (often called Welch's t-test). Two separate groups, with no assumption about their spread. When unsure, use this one.
The choice matters. If the quiz data were seven learners tested twice, a paired test, =T.TEST(B2:B8,C2:C8,2,1), would give about 0.019 instead of 0.0039. It's a different question, so it gets a different answer.
How to read the p-value correctly#
The p-value is the probability of seeing a difference at least as large as yours if the true averages were equal. For the quiz data, p ≈ 0.0039 means that if both methods really produced the same average score, a gap of 6.1 points or more would turn up in only about 0.4% of samples like this one.
The usual rule is to call a result statistically significant when p is below 0.05, a cut-off chosen before the test. By that rule, the quiz result is significant.
Three things a p-value does not tell you:
- It isn't the chance that the result is a fluke. A p-value of 0.0039 doesn't mean a 0.39% chance that Method B is no better.
- It isn't the size of the effect. A tiny, unimportant difference can have a small p-value if the sample is huge. Always report the difference itself: 6.1 points.
- A p-value above 0.05 doesn't prove the groups are equal. It only means this data doesn't give strong evidence of a difference. Small samples often miss real differences.
How to run a t-test with the Analysis ToolPak#
The Analysis ToolPak gives a full results table, including the t statistic that T.TEST doesn't show. It is an add-in that comes with desktop Excel but is switched off by default.
- Turn it on. Windows: File > Options > Add-ins, choose Excel Add-ins in the Manage box, click Go and tick Analysis ToolPak. Mac: Tools > Excel Add-ins and tick Analysis ToolPak.
- Go to Data > Data Analysis and pick t-Test: Two-Sample Assuming Unequal Variances (or the Paired or Equal Variances version).
- Set Variable 1 Range to B1:B8 and Variable 2 Range to C1:C8, tick Labels, leave Hypothesized Mean Difference at 0 and Alpha at 0.05.
- Choose an output cell and click OK.
The key rows of the output for the quiz data:
| Row | Method A | Method B |
|---|---|---|
| Mean | 70.86 | 77.00 |
| Variance | 10.14 | 10.67 |
| Observations | 7 | 7 |
| df | 12 | |
| t Stat | -3.56 | |
| P(T<=t) two-tail | 0.0039 | |
| t Critical two-tail | 2.18 |
The t Stat is negative only because Method A came first. What matters is its size: 3.56 is bigger than the critical value 2.18, which is the same conclusion as p below 0.05. Unlike T.TEST, the ToolPak output is a fixed table of values, so run it again if the data changes.
Check your data before you trust the result#
A t-test is reliable when its basic conditions hold, and a few quick checks catch most problems:
- Independent values. Each score should come from a different person or item, unless you use the paired type.
- No extreme outliers. Compare the average and the median, and look at MIN and MAX. One wild value can swing a small sample. The median and mode lesson practises the median check.
- Roughly symmetric data, especially with small groups. Very skewed data, such as incomes, may need a different test.
- Spread. The guide to standard deviation in Excel shows how to measure it; similar spreads support type 2, very different spreads call for type 3. See STDEV.S vs STDEV.P for which formula to use on a sample.
A t-test compares exactly two groups. For three or more, such as Methods A, B and C, use analysis of variance (the ToolPak's Anova: Single Factor) rather than several t-tests.
Practise it#
A t-test is only as good as the averages behind it. Try the exercise on this page, which measures the gap before any test, then practise AVERAGE, MIN and MAX in a live spreadsheet and practise MEDIAN and MODE. Each lesson checks your formula the moment you press Enter.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Seven learners used Method A and seven others used Method B. Before any t-test, look at the size of the difference. Click F2 and calculate the average of Method B (C2:C8) minus the average of Method A (B2:B8).
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Method B | ||||||
| 2 | Difference | ||||||
| 3 | |||||||
| 4 | |||||||
| 5 | |||||||
| 6 | |||||||
| 7 | |||||||
| 8 | |||||||
| 9 | |||||||
| 10 | |||||||
| 11 |
Tip: Subtract one AVERAGE from another: AVERAGE(C2:C8) minus AVERAGE(B2:B8).
Practise this in a lesson
Frequently asked questions
What does T.TEST return in Excel?
T.TEST returns the p-value of a Student's t-test. It does not return the t statistic itself. To see the t statistic, degrees of freedom and critical values, use the Analysis ToolPak's t-Test tools.
Which type should I use in T.TEST?
Use 1 when the two ranges are paired, such as the same people before and after. For two separate groups, use 3 (unequal variances), which is a safe default, or 2 if you have good reason to assume equal variances.
What does a p-value of 0.05 mean?
It means that if the two groups truly had the same average, a difference at least as large as yours would appear in about 5% of samples. It does not mean there is a 95% chance your result is real.
Should I use a one-tailed or two-tailed t-test?
Use two tails in most cases. A one-tailed test is only fair when you decided the direction of the difference before collecting the data. Switching to one tail after seeing the result halves the p-value and overstates the evidence.
What is the difference between TTEST and T.TEST?
They give the same result. T.TEST was added in Excel 2010 and is the current name. TTEST is kept for compatibility with older files.