← All resources

Formula for T Test in Excel: How to Use T.TEST in 4 Steps

7 min read
Formula for T Test in Excel: How to Use T.TEST in 4 Steps

The formula for t test in Excel is =T.TEST(array1, array2, tails, type). Select your two data ranges, enter 2 for a two-tailed test, and enter 1, 2, or 3 for paired, equal-variance, or unequal-variance data. Excel returns the p-value directly. If it falls below 0.05, the difference between your two means is statistically significant at the usual threshold.

The trouble is that the formula gives you almost no feedback. Pick the wrong type and it still returns a confident-looking number. Change the tails argument and the p-value doubles or halves. Excel's help page lists the arguments but does not tell you which values suit your data, and it never shows you how to read the result.

This guide walks through four steps: choosing tails and type, entering the formula, reading the p-value, and adapting the formula for one-sample tests and summary statistics. The examples use data small enough to retype in a minute. PlotStudio AI is built for researchers who run tests like this, so the guide also flags the mistakes that most often change a conclusion.

What the T.TEST formula does and what it needs

T.TEST returns the p-value of a Student's t-test, not the t-statistic. It answers one question: how likely is a difference this large between your sample means if both samples came from populations with the same mean? A small p-value says that is unlikely.

What you need before typing anything

Put each group in its own column, with a label in row 1 and values from row 2 down. For a paired test, each row must be one subject, such as a patient's before and after readings, because Excel matches values by position. Independent groups can have different lengths, but paired data cannot.

Syntax and arguments

The formula takes four required arguments. The older TTEST name still works for compatibility, but T.TEST is the current one.

Argument What to enter
array1 The first data range, such as A2:A10
array2 The second data range, such as B2:B10
tails 1 for a one-tailed test, 2 for a two-tailed test
type 1 for paired, 2 for two-sample equal variance, 3 for two-sample unequal variance

T.TEST gives you the p-value in one cell, so the real work is choosing tails and type correctly.

Step 1. Choose your tails and test type

Decide two things before you write the formula: whether the test is one-tailed or two-tailed, and which of the three test types matches how your data was collected. Both choices come from your study design, not from the numbers.

Pick tails: 1 or 2

Use 2 tails unless you committed to a direction before seeing the data, for example "the new protocol can only increase scores." A two-tailed test detects a difference in either direction. Excel's two-tailed p-value is exactly double the one-tailed value, so choosing 1 after the fact halves your p-value and is not honest.

Pick the type: 1, 2, or 3

Type depends on whether the groups are linked and whether their spread is similar.

Hub diagram linking the type argument to paired, equal-variance and unequal-variance t-tests.

Type Test Use it when
1 Paired The same subjects are measured twice, or each value in one group is matched to one in the other
2 Two-sample, equal variance Two independent groups with similar spread
3 Two-sample, unequal variance Two independent groups, or you are unsure about the spread

If you are unsure between 2 and 3, choose type 3. It costs little when the variances are equal and protects you when they are not. You can compare spread with =F.TEST(A2:A10,B2:B10), but a high result is not proof that the variances match.

Match the type to the study design first: linked measurements are type 1, independent groups are type 2 or 3.

Step 2. Enter the formula in a cell

Click an empty cell, type the formula with your ranges and chosen arguments, and press Enter. The cell shows the p-value. Nothing else is needed.

Try it on sample data

Type these values with headers in row 1. Put group A in A2:A10: 3, 4, 5, 8, 9, 1, 2, 4, 5. Put group B in B2:B10: 6, 19, 3, 2, 14, 4, 5, 17, 1. Treat the rows as before and after measurements, then enter this in D2:

A laptop showing a spreadsheet with two data columns and one highlighted cell, next to a notepad.

=T.TEST(A2:A10,B2:B10,2,1)

Excel returns 0.196016. The two other test types use the same pattern. Only the last argument changes:

=T.TEST(A2:A10,B2:B10,2,2)
=T.TEST(A2:A10,B2:B10,2,3)

When you also need the t-statistic

T.TEST hides the t-statistic and degrees of freedom. To see them, turn on the Analysis ToolPak (File, Options, Add-ins, Analysis ToolPak, Go). Then choose Data, Data Analysis and pick the matching "t-Test" option. The ToolPak prints a static table, while the formula updates automatically when your data changes, so use the formula for live work and the ToolPak when you need the full output.

Use T.TEST when you need a live p-value, and the ToolPak when you need the t-statistic and degrees of freedom.

Step 3. Read the p-value correctly

Compare the p-value to your significance level, usually 0.05. A p-value below 0.05 means you reject the null hypothesis of equal means. A p-value above it means the data do not show a reliable difference.

Interpret the sample result

Our paired example returned p = 0.196, so it is not significant at 0.05. The mean difference was about 3.3 units, but with only nine pairs and a standard deviation of differences near 7.1, that gap is within chance variation. The t-statistic works out to about -1.41 with 8 degrees of freedom. Had you chosen one tail, the formula would return roughly 0.098, still above 0.05.

A printed dot plot of nine paired measurements joined by lines, with a magnifying glass and pencil.

A p-value is not an effect size. Report both group means and the p-value, and remember that a t-test assumes independent observations and roughly normal data, or differences, in small samples.

Fix the three error values

Error Cause Fix
#N/A Type 1 with ranges of different length Make both ranges the same size and aligned by row
#VALUE! Tails or type is not a number Enter plain numbers, not text
#NUM! Tails is not 1 or 2 Use exactly 1 or 2

A p-value of 0.196 means the data are compatible with no difference, not that you have proven there is none.

Step 4. Adapt it for one-sample tests and summary stats

T.TEST is built for two samples, but two small adjustments cover the other common requests: comparing one sample to a known value, and testing from a mean and standard deviation alone.

Run a one-sample t-test

To test whether a mean differs from a fixed value, such as 50, pair each observation with that value. Assuming your data sit in A2:A21:

=T.TEST(A2:A21,A2:A21*0+50,2,1)

This works because a paired test on x minus 50 is the one-sample test. In older Excel versions without dynamic arrays, confirm it with Ctrl+Shift+Enter.

Test from a mean and standard deviation

T.TEST needs raw values. If you only have a mean, standard deviation, and sample size, compute t and then the p-value yourself. Suppose the mean is 52.4, the SD is 6.1, n is 25, and the reference value is 50:

=(52.4-50)/(6.1/SQRT(25))
=T.DIST.2T(ABS(1.967),24)

The first formula gives t = 1.967. The second gives a two-tailed p-value of about 0.061, using n minus 1 degrees of freedom. For two groups with only summary statistics, the hand calculation is longer and easier to get wrong, so use raw data when you can.

Pair every value with the reference number to turn T.TEST into a one-sample test, or use T.DIST.2T when you only have summary statistics.

Run the test, then check the result

The formula is =T.TEST(array1, array2, tails, type), and the arguments matter more than the syntax. Use 2 tails by default, match the type to your design, and read the output as a p-value, not a t-statistic. Compare it to 0.05, and report the group means beside it.

If you would rather not manage formulas, try PlotStudio AI free. You upload your spreadsheet, ask for the t-test in plain English, and review the test choice, assumptions, and Python code behind the result. It needs no credit card to start, and the final interpretation stays with you.

Formula for T Test in Excel: How to Use T.TEST in 4 Steps | PlotStudio AI