Asset 20 8 2
Does AI recommend your business? Run the free check →

Join 15,000 business owners, marketers and entrepreneurs. The Sunday newsletter you'll be annoyed only arrives once a week.

Article

How to Do a T-Test in Excel (T.TEST and the ToolPak)

To do a t-test in Excel, type =T.TEST(range1, range2, 2, 2) in a cell. The first 2 means a two-tailed test, and the second sets the test type: 1 for paired data, 2 for equal variances, 3 for unequal variances. The answer is the p-value, and the Analysis ToolPak gives a full results table.

Excel gives you two ways to run a t-test. The T.TEST function gives you a single number, the p-value, in one cell. The Analysis ToolPak gives you a full table with the means, the t statistic and the critical values. Most people need the p-value, and most people get the test type wrong, so that's where this guide starts.

Pick the right test type first

Your dataType numberExample
The same people or items measured twice1 (paired)Scores before and after a training session
Two separate groups with similar spread2 (equal variance)Two classes taking the same test
Two separate groups with different spread3 (unequal variance)Response times from two very different sites

If you're not sure whether the spreads are similar, type 3 is the safer choice for two separate groups. It doesn't assume the groups vary by the same amount, and it gives almost the same answer as type 2 when they do.

How to do a t-test with the T.TEST function

  1. Put each group's numbers in its own column, for example A2 to A9 and B2 to B9.
  2. Click an empty cell.
  3. Type =T.TEST(A2:A9, B2:B9, 2, 3).
  4. Change the third number to 1 for a one-tailed test, if you're only testing whether one group is higher.
  5. Change the fourth number to 1, 2 or 3 to match your test type.
  6. Press Enter. The result is the p-value.

For a paired test, both columns must have the same number of values in the same order, because Excel pairs the first value with the first, the second with the second, and so on.

How to read the result

The number T.TEST returns is the probability of seeing a difference this big if the two groups were really the same. The usual rule of thumb is a cut-off of 0.05:

  • Below 0.05: the difference is statistically significant at that level.
  • Above 0.05: you don't have enough evidence of a difference.

A p-value doesn't tell you how big or important the difference is. Always look at the two averages as well.

How to do a t-test with the Analysis ToolPak

  1. Turn on the ToolPak: choose File, then Options, then Add-ins.
  2. At the bottom, choose Excel Add-ins in the Manage box and click Go.
  3. Tick Analysis ToolPak and click OK.
  4. On the Data tab, click Data Analysis.
  5. Choose the t-Test that matches your data: Paired Two Sample for Means, Two-Sample Assuming Equal Variances, or Two-Sample Assuming Unequal Variances.
  6. Select the two ranges, tick Labels if your first row has headings, and choose where to put the output.
  7. Click OK.

The output table shows each group's mean and variance, the t statistic, the one-tailed and two-tailed p-values, shown as P(T<=t), and the critical values. If the t statistic is bigger than the critical value, ignoring the sign, the result is significant.

Why the ToolPak and T.TEST disagree

This catches people out. For the unequal variance test, Microsoft says the ToolPak rounds the degrees of freedom to a whole number before working out the result, while the T.TEST function uses the exact value. So the two can give slightly different p-values for the same data. Neither is broken. If you need to match a textbook or a colleague, check which method they used, and report the one you used.

T.TEST or TTEST?

You'll see an older function called TTEST without the dot. It does the same job, but Microsoft keeps it only for compatibility and says it may not be available in future versions. Use T.TEST in anything new.

Common t-test mistakes in Excel

  • Using paired when the groups are separate people. Paired is only for the same subjects measured twice.
  • Including headings in the range. T.TEST needs numbers only, so start the range below the heading.
  • Blank cells in a paired test. Gaps break the pairing, so remove incomplete pairs first.
  • Choosing one-tailed after looking at the data. Decide one-tailed or two-tailed before you run the test. Two-tailed is the default for good reason.

When a t-test isn't the right tool

A t-test compares the averages of two groups. If you've got three or more groups, use an analysis of variance, which the ToolPak also offers as ANOVA, rather than running lots of t-tests. If your data are counts or yes-or-no answers, such as how many people clicked a button on two versions of a page, a t-test on averages isn't the best fit either. That's a job for a test of proportions, which you can work out in Excel or with an online calculator.

Work with me

Want AI doing the heavy lifting in your marketing?

I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.

If you're testing results from your own marketing, my guide to measuring social media success without an analytics tool covers what's worth comparing in the first place.

My verdict

For a quick answer, =T.TEST(range1, range2, 2, 3) is the formula to remember: two-tailed, unequal variances, safe for two separate groups. Switch the last number to 1 if it's the same people measured twice. Use the Analysis ToolPak when you need the full table for a report, and don't panic if its p-value is a touch different from T.TEST's on unequal variances. For turning results into something clients can read, see building dashboards with AI.

Frequently asked questions

What's the formula for a t-test in Excel?

=T.TEST(array1, array2, tails, type), where tails is 1 or 2 and type is 1, 2 or 3.

What does T.TEST return in Excel?

It returns the p-value, the probability of seeing the difference if the groups were the same.

How do I get the t statistic in Excel?

Use the Analysis ToolPak's t-Test tool, which reports the t statistic alongside the p-values.

Where is Data Analysis in Excel?

On the Data tab, once you've turned on the Analysis ToolPak under File, Options, Add-ins.

Should I use one-tailed or two-tailed?

Two-tailed, unless you decided before collecting data that you only care about one direction.

Why are my T.TEST and ToolPak results different?

For unequal variances, the ToolPak rounds the degrees of freedom while T.TEST doesn't.

Published and maintained by the Lilach Bullock team, covering marketing, AI and business growth.
Your buyers are asking AI who to use. Does it say you?

See for free whether ChatGPT, Claude, Perplexity, Gemini and Google name you, and get the plan to become the answer.

Check my AI visibility →
Sundays only

Get the Sunday newsletter.

One email a week. AI experiments, marketing tactics, and the workflows Lilach is building right now in her own business.

Subscribe free

Let’s get your marketing running on AI.

Book a free 30-minute call

We figure out what you need, where AI fits in, and what working together would look like.

Book the call →

Or take the 30-second calculator

You’ll see the hours and the money quietly leaking out of your week, and the three workflows worth building first.

Take the calculator →

Or grab the free AI resource library

Prompt packs, templates, checklists, and swipe files. The exact tools I build for paying clients. Yours, free.

Get the library →
Keep reading

More from the blog.