How to Do a T-Test in Excel: Step by Step

To do a t-test in Excel, put your two groups of data in two columns. In an empty cell, type =T.TEST(A2:A9,B2:B9,2,3) and press Enter. The result is the p-value. If it is below 0.05, the difference between the two group means is statistically significant at the usual 5% level.
This guide explains what a t-test does and how to pick the right type. It then shows two ways to run a t-test in Excel: the T.TEST function and the Analysis ToolPak. It also covers how to read the output, with a worked example. Function details come from Microsoft's support pages, read on November 17, 2026.
What a t-test tells you
A t-test checks whether the difference between two averages is likely to be real or just random noise. You use it when you compare two groups and want to know if they truly differ.
Microsoft describes the purpose of the T.TEST function this way. It helps "to determine whether two samples are likely to have come from the same two underlying populations that have the same mean."
The output you care about is the p-value. It answers a simple question. If the two groups really had the same average, how likely is a difference this large?
- A small p-value, such as 0.01, means the difference would be rare by chance. You conclude the means differ.
- A large p-value, such as 0.40, means the difference could easily be random. You cannot conclude the means differ.
Most people use 0.05 as the cutoff. That level is called alpha. Pick it before you run the test, not after.
Common uses of a t-test include:
- Comparing sales before and after a price change.
- Comparing test scores from two teaching methods.
- Comparing task times for an old and a new process.
- Comparing conversion rates from two versions of a page, when you have daily figures.
For a deeper look at p-values, see our explainer on what statistical significance is.
Choose the right type of t-test
Excel offers three types of t-test. Choosing the wrong one gives the wrong p-value, so this step matters.
| Type | Excel type number | Use it when |
|---|---|---|
| Paired | 1 | The same subjects are measured twice, such as before and after |
| Two-sample, equal variance | 2 | Two separate groups with a similar spread |
| Two-sample, unequal variance | 3 | Two separate groups whose spread may differ |
Microsoft's ToolPak page describes when to use a paired test. It fits "when there is a natural pairing of observations in the samples." The page gives the example of a group tested twice, before and after an experiment.
For two separate groups, the page says to use the two-sample test "when there are distinct subjects in the two samples."
If you are unsure whether the variances are equal, use type 3. It is the safer choice and is often called Welch's t-test. It gives almost the same answer as type 2 when the spreads are similar.
You also choose the number of tails:
- Two-tailed (2): You want to know if the means differ in either direction. This is the usual choice.
- One-tailed (1): You only care about one direction, such as whether the new process is faster. Decide this before you look at the data.
Microsoft notes that the two-tailed value is "double that returned when tails=1."
Set up your data
Put each group in its own column, with a header in row 1. For example, column A holds Team A's times and column B holds Team B's times.
A few rules keep the t-test valid:
- One value per cell. Do not mix units or add notes in the data cells.
- No blank rows inside the data. Blank cells can shift paired values out of line.
- Equal length for paired data. A paired test needs one value per subject in each column.
- Similar measurement. Both columns must measure the same thing in the same unit.
For a paired test, keep each subject on the same row. Row 2 holds subject 1's before and after values, row 3 holds subject 2, and so on.
Take a quick look at the data before testing. Calculate the mean of each column with =AVERAGE(A2:A9). A t-test tells you if a gap is significant, but you still need to know how big the gap is.
Check the assumptions first
A t-test rests on a few assumptions. Excel will run the test either way, so it is up to you to check them.
- Independent observations. Each value should not depend on another. Daily figures from the same team are usually fine, but repeated readings of the same item are not.
- Roughly normal data. The values in each group should follow a bell shape without extreme skew. With 30 or more values per group, this matters much less.
- No extreme outliers. One very large or small value can swing the mean and the p-value. Look at the data, or make a quick box plot, before you test.
- The right comparison. The test compares means only. If the groups differ in shape or spread, report that as well.
If your data breaks these rules badly, a t-test may mislead you. A rank-based test, such as the Mann-Whitney test, is a common alternative. Microsoft's ToolPak page lists t-tests, ANOVA, and other tools, but many teams run rank-based tests in a statistics package instead.
Method 1: Use the T.TEST function
The T.TEST function is the fastest way to do a t-test in Excel. Microsoft says it "Returns the probability associated with a Student's t-Test."
The syntax is T.TEST(array1,array2,tails,type):
- array1 is the first data set.
- array2 is the second data set.
- tails is 1 for one-tailed or 2 for two-tailed.
- type is 1 for paired, 2 for equal variance, or 3 for unequal variance.
For two separate teams with possibly different spreads, type:
=T.TEST(A2:A9,B2:B9,2,3)
Excel returns one number: the p-value. Compare it with your alpha, such as 0.05.
Watch for three errors. Microsoft lists them clearly:
- If the arrays have a different number of points and type is paired, T.TEST "returns the #N/A error value."
- If tails or type is not a number, it "returns the #VALUE! error value."
- If tails is anything other than 1 or 2, it "returns the #NUM! error value."
Microsoft's own example uses nine pairs of values and a paired, two-tailed test. The formula =T.TEST(A2:A10,B2:B10,2,1) returns 0.196016. That p-value is well above 0.05, so the pairs do not show a significant difference.
T.TEST is quick, but it only gives the p-value. If you need the t statistic, the means, or the degrees of freedom, use the Analysis ToolPak.
Method 2: Use the Analysis ToolPak
The Analysis ToolPak is a free add-in that ships with Excel. Microsoft says it lets you "save steps and time" on complex statistical work. It builds a full output table for a t-test.
Turn on the Analysis ToolPak
On Windows:
- Select File > Options, and then select the Add-Ins category.
- In the Manage box, select Excel Add-ins, and then select Go.
- In the Add-Ins box, check Analysis ToolPak, and then select OK.
On a Mac, select Tools > Excel Add-ins, check Analysis ToolPak, and select OK. Microsoft adds: "Now the Data Analysis command is available on the Data tab."
Run the t-test
- Select Data > Data Analysis.
- Pick one of the three t-test tools, such as t-Test: Two-Sample Assuming Unequal Variances.
- Set Variable 1 Range to A1:A9 and Variable 2 Range to B1:B9.
- Check Labels if your ranges include the headers.
- Leave Hypothesized Mean Difference at 0.
- Set Alpha to 0.05.
- Choose an output cell or a new worksheet, and select OK.
Excel writes a table with the mean, variance, and number of observations for each group. It also shows the degrees of freedom, the t statistic, and the p-values.
How to read the output
The ToolPak table has several rows. These are the ones that matter.
- Mean. The average of each group. This shows the size and direction of the gap.
- t Stat. Microsoft notes it "can be negative or nonnegative," depending on which group is larger.
- P(T<=t) two-tail. The two-tailed p-value. Compare it with alpha.
- t Critical two-tail. The cutoff value for the t statistic at your alpha.
- df. The degrees of freedom. For unequal variances, Microsoft says this value is "usually not an integer" before rounding.
The decision rule is simple. If the two-tail p-value is below alpha, the difference is significant. You can also check whether the absolute t Stat is bigger than the t Critical two-tail. Both checks give the same answer.
Report the result in plain terms. For example: "Team B was 5.5 minutes faster on average, and the difference was significant (p < 0.001)."
A worked example: comparing two teams
A support manager wants to know if a new process cuts handling time. Team A uses the old process, and Team B uses the new one. Each team logs its average handling time, in minutes, over eight days.
| Day | Team A (old) | Team B (new) |
|---|---|---|
| 1 | 42 | 36 |
| 2 | 38 | 35 |
| 3 | 45 | 40 |
| 4 | 40 | 33 |
| 5 | 44 | 38 |
| 6 | 39 | 34 |
| 7 | 41 | 37 |
| 8 | 43 | 35 |
These are two separate teams, so a paired test is wrong. The manager does not know if the spreads are equal, so type 3 is the safe choice.
- The means are 41.5 minutes for Team A and 36 minutes for Team B. The gap is 5.5 minutes.
- The formula
=T.TEST(B2:B9,C2:C9,2,3)returns a p-value of about 0.0004. - The ToolPak shows a t Stat of about 4.66.
The p-value is far below 0.05. The manager can conclude that Team B's handling time is lower, and that the gap is very unlikely to be chance.
A note of caution: the t-test shows the gap is real, not why it exists. If Team B also has more experienced staff, the process may not be the cause. Design the comparison carefully before you credit a change.
Do a t-test in Excel with AI
The steps above are quick for one comparison. They take longer when you have many groups, messy exports, or need to explain the result to others. An AI tool can run the calculation and write up the finding.
Here is the method in three steps, using Powerdrill Bloom.
Step 1: Upload your Excel file
Upload the workbook or CSV that holds your two groups. The Excel Calculations page says to make sure your data "is correctly formatted to enable smooth calculations."
Keep one group per column, with clear headers. This makes the request easier to state.
Step 2: Ask for the t-test in natural language
Describe the test you need. For example: "Run a two-tailed t-test with unequal variances comparing Team A and Team B handling times."
The page says you can "Input your desired calculation request in text," and that the tool "will recognize and apply the correct formula." Ask it to show the means, the t statistic, and the p-value.
Step 3: Check the result and share the summary
Compare the p-value with a T.TEST formula in your own sheet. If they match, ask for a short summary and a chart of the two group means.
Keep the T.TEST formula in your workbook, so the result updates when new data arrives.
Common mistakes to avoid
These are the problems that come up most often when you do a t-test in Excel.
- Wrong type. Use paired only when the same subjects appear in both columns.
- Assuming equal variance. When in doubt, use type 3.
- Choosing tails after the fact. Decide on one or two tails before you look at the result.
- Reading the wrong row. In the ToolPak, use the two-tail p-value unless you planned a one-tailed test.
- Ignoring the size of the gap. A tiny gap can be significant with lots of data. Report the means too.
- Treating p > 0.05 as proof of no difference. It only means the data cannot show one.
- Misaligned pairs. In a paired test, a missing value shifts every row below it.
For related guides, see how to analyze A/B test results without a statistician and how to make a box plot in Excel.
When you have many groups to compare, try Powerdrill Bloom with your export and ask for each test in one sentence.
Frequently asked questions
What is the formula for a t-test in Excel?
Use =T.TEST(array1,array2,tails,type). For example, =T.TEST(A2:A9,B2:B9,2,3) runs a two-tailed test with unequal variances and returns the p-value.
Which t-test type should I use in Excel?
Use type 1 when the same subjects are measured twice. Use type 3 for two separate groups unless you know their variances are equal, in which case type 2 also works.
How do I interpret the p-value from a t-test?
If the p-value is below your alpha, usually 0.05, the difference between the means is statistically significant. If it is above, the data does not show a clear difference.
Where is the Data Analysis button in Excel?
It appears on the Data tab after you load the Analysis ToolPak. On Windows, go to File > Options > Add-Ins, choose Excel Add-ins, and check Analysis ToolPak.
Can I do a t-test in Excel without the Analysis ToolPak?
Yes. The T.TEST function needs no add-in. It returns the p-value directly, though it does not show the t statistic or the means.
Sources: Microsoft Support, T.TEST function · Microsoft Support, Use the Analysis ToolPak to perform complex data analysis · Microsoft Support, Load the Analysis ToolPak in Excel.