How to do a t test in Excel (2 ways with interpretation of results)

To do a t test in Excel, type =T.TEST(array1,array2,tails,type) in an empty cell for a quick p-value, or run a t-Test tool from Data > Data Analysis for a full table with the t statistic, degrees of freedom and critical values.

Both ways are below, with the data layout each needs, a worked example on Microsoft's own sample data, and how to interpret every number Excel returns.

Method 1: Using the T.TEST function in Excel

T.TEST returns the probability (the p-value) of a Student's t-test in a single cell. It works in every current version of Excel and needs no add-in.

  1. Put the first sample in one column, for example A2:A10, and the second sample in the next column, for example B2:B10.
  2. Select an empty cell for the result.
  3. Type =T.TEST(A2:A10,B2:B10,2,1), changing the ranges to match your data.
  4. Set the third argument, tails, to 2 for a two-tailed test or 1 for a one-tailed test.
  5. Set the fourth argument, type, to 1 for paired data, 2 for two samples with equal variance, or 3 for two samples with unequal variance.
  6. Press Enter. The cell shows the p-value, a number between 0 and 1.
  7. Compare it with your significance level, such as 0.05. A p-value below that level means the difference in means is statistically significant.

T.TEST gives only the p-value. Use Method 2 when you also need the t statistic, degrees of freedom, means and variances. The older TTEST function still exists for compatibility with earlier versions of Excel.

T.TEST function in Excel returning the p-value for two sample columns
With tails 2 and type 3, T.TEST and the older TTEST return the same p-value, 0.186749, for these samples. (Image: Microsoft Q&A)

Understanding the t-test

A t-test checks whether two samples are likely to come from populations with the same mean. Excel offers three kinds, and the one you pick changes the answer.

Kind of t-test Use it when T.TEST type Analysis ToolPak tool
Paired The same subjects are measured twice, such as before and after a change 1 t-Test: Paired Two Sample for Means
Two-sample, equal variance (homoscedastic) Two separate groups whose spread is about the same 2 t-Test: Two-Sample Assuming Equal Variances
Two-sample, unequal variance (heteroscedastic) Two separate groups whose spread differs 3 t-Test: Two-Sample Assuming Unequal Variances

The null hypothesis is that the two population means are equal. The p-value is the probability of a t statistic at least this extreme if that null hypothesis were true.

Prerequisites and assumptions

A t-test result is only as good as the data behind it. Check these assumptions before you trust the p-value.

Assumption What it means How to check it in Excel
Numeric data Every value in the ranges is a number Text in the tails or type argument returns #VALUE!
Matched pairs for a paired test Each row holds two measurements of the same subject Both ranges must have the same number of values, or T.TEST returns #N/A with type 1
Independent groups for a two-sample test No subject appears in both samples Check your source data; Excel cannot test this
Roughly normal data Each sample, or the paired differences, follows a bell-shaped distribution Run Descriptive Statistics or a Histogram from Data Analysis and look for heavy skew
Equal or unequal variance Decides between type 2 and type 3 Run F-Test Two-Sample for Variances; an F value close to 1 points to equal variances

How to enable the Data Analysis ToolPak in Excel

Method 2 needs the Analysis ToolPak add-in. If Data Analysis is missing from the Data tab, load the add-in first.

  1. In Excel for Windows, select File > Options, then select the Add-ins category.
  2. In the Manage box, select Excel Add-ins and then select Go.
  3. Tick Analysis ToolPak and select OK.
  4. If it is not in the list, select Browse to locate it. If Excel says it is not installed, select Yes to install it.
  5. On a Mac, select Tools > Excel Add-ins, tick Analysis ToolPak, select OK, then quit and restart Excel.
  6. Open the Data tab and check that Data Analysis now appears.
Enable the Data Analysis ToolPak in Excel from Excel Options Add-ins
Once loaded, Analysis ToolPak is listed under Active Application Add-ins with the type Excel Add-in. (Image: Microsoft Q&A)

Preparing your data for a t test in Excel

Both methods read two ranges, so lay the samples out in two columns with one value per cell and no blank rows inside the data.

Test Layout Watch out for
Paired Column A holds the before values and column B the after values, one subject per row A missing value in one column breaks the pairing; remove that subject's whole row
Two-sample Column A holds group 1 and column B holds group 2; the groups can differ in size Do not sort one column on its own if the rows mean something
Either test, with headers Put a label such as Before or Group A in row 1 Leave the header out of the T.TEST ranges; in the ToolPak, tick its labels option so the header is not read as data

If the two measurements for each subject live in separate tables, VLOOKUP in Excel can pull the matching value into the same row before you run a paired test.

Method 2: Using the Data Analysis ToolPak

The ToolPak writes a complete output table: means, variances, observations, degrees of freedom, the t statistic and one-tailed and two-tailed p-values with critical values.

  1. Select Data > Data Analysis.
  2. Pick t-Test: Paired Two Sample for Means, t-Test: Two-Sample Assuming Equal Variances or t-Test: Two-Sample Assuming Unequal Variances, then select OK.
  3. In the first variable range box, select the cells of the first sample, such as A1:A10.
  4. In the second variable range box, select the cells of the second sample, such as B1:B10.
  5. If your selection includes the header row, tick the labels option.
  6. Enter 0 as the hypothesized difference between the means, unless you are testing for a specific gap.
  7. Leave alpha at your significance level, such as 0.05.
  8. Choose where the output goes, an output range on this sheet or a new worksheet, then select OK.
  9. Read the table Excel creates, using the interpretation guide below.

The tool works on one worksheet at a time. If several sheets are grouped, results appear on the first sheet and the others get empty formatted tables, so ungroup the sheets first.

How to interpret t test results in Excel

The ToolPak output has the same rows for all three t-tests, apart from a few extras. This is what each row tells you.

Output row What it means How to use it
Mean The average of each sample Shows which group is higher and by how much
Variance The spread of each sample Very different variances point to the unequal-variance test
Observations How many values Excel read from each range Check it matches your data, which catches a header read as a value
Pooled Variance (equal-variance test only) A combined measure of the spread of both samples about the mean Used inside the calculation; no decision rests on it
df Degrees of freedom; the unequal-variance test rounds it to the nearest integer for the critical value Needed if you quote the result, as t(df) = value
t Stat The t statistic; negative when the first sample's mean is lower The size matters, the sign shows direction
P(T<=t) one-tail Probability of a t statistic more extreme in the direction of t, if the means were equal Use only when you predicted the direction in advance
t Critical one-tail The cutoff a t statistic must pass for a one-tailed result to be significant at alpha Compare the absolute t Stat with it
P(T<=t) two-tail Probability of a t statistic larger in absolute value than t, if the means were equal The p-value to report in most cases; it matches T.TEST with tails 2
t Critical two-tail The cutoff for a two-tailed result at alpha If the absolute t Stat is larger, the difference is significant
How to do a t test in Excel (2 ways with interpretation of results)
The table lists Mean, Variance, Observations, df, t Stat, and one-tail and two-tail p-values with their critical values. (Image: Microsoft Q&A)

How to tell if a t test is significant in Excel

  1. Find the two-tailed p-value: the T.TEST result with tails 2, or the P(T<=t) two-tail row of the ToolPak table.
  2. Compare it with your significance level, usually 0.05.
  3. If the p-value is below 0.05, reject the null hypothesis: the means differ significantly.
  4. If the p-value is 0.05 or above, the data do not show a significant difference. That is not proof that the means are equal.
  5. Cross-check with the ToolPak table: the absolute t Stat is larger than t Critical two-tail exactly when the p-value is below alpha.
  6. Report the direction from the Mean rows, plus t, df and p, for example t(8) = -1.41, p = 0.196.

Practical examples of a t test in Excel

These examples use the sample data from Microsoft's T.TEST help page. Data 1 in A2:A10 is 3, 4, 5, 8, 9, 1, 2, 4, 5. Data 2 in B2:B10 is 6, 19, 3, 2, 14, 4, 5, 17, 1.

Example Formula or tool Result Interpretation
Example 1: Paired t-test for before-after data =T.TEST(A2:A10,B2:B10,2,1) 0.196016 (Microsoft's published result) Above 0.05, so the before and after means are not significantly different
Same data in the ToolPak paired tool t-Test: Paired Two Sample for Means t Stat about -1.41, df 8, t Critical two-tail about 2.31 |-1.41| is below 2.31, which agrees with the p-value
Example 2: Independent t-test, equal variances =T.TEST(A2:A10,B2:B10,2,2) About 0.192 Above 0.05, so group means of about 4.56 and 7.89 do not differ significantly
Critical value without the ToolPak =T.INV.2T(0.05,8) About 2.306 The two-tailed cutoff for 8 degrees of freedom at alpha 0.05

The variances here are about 6.8 and 47.1, which is a large gap. For real independent groups with spreads that different, the unequal-variance test, type 3, is the safer choice.

T test in Excel example: Microsoft sample data with the paired T.TEST formula
On this sample data, a paired two-tailed T.TEST returns 0.196016, above 0.05, so the means are not significantly different. (Image: Microsoft)

Additional considerations for a t test in Excel

Question Answer
One tail or two? Use two tails unless you stated the direction of the difference before collecting the data. With tails 2, T.TEST returns double the one-tailed value.
Which variance option? Run F-Test Two-Sample for Variances first, or use type 3 when in doubt, since it does not assume equal spread.
Does T.TEST accept decimals for tails or type? It truncates them to whole numbers, so 2.7 becomes 2.
Can I use the ToolPak on a Mac? Yes. Load it from Tools > Excel Add-ins, restart Excel, and Data Analysis appears on the Data tab.
Can I analyse several sheets at once? No. The tools run on one worksheet at a time, so rerun the tool on each sheet.
Is a significant result an important one? Not necessarily. Report the difference in means alongside p, because a tiny gap can be significant with a large sample.

Common mistakes and tips

T.TEST returns #N/A

You chose type 1 (paired) but the two ranges hold different numbers of values.

  1. Check that both ranges cover the same rows, such as A2:A10 and B2:B10.
  2. Remove subjects that are missing one of their two measurements.
  3. Use type 2 or 3 if the samples are not really paired.

T.TEST returns #NUM!

The tails argument is something other than 1 or 2.

  1. Change the third argument to 1 or 2.
  2. Check that you did not swap the tails and type arguments.

T.TEST returns #VALUE!

The tails or type argument is not a number.

  1. Replace text such as "two" with the number 2.
  2. If those arguments point to cells, make sure the cells hold numbers, not text.

Data Analysis is missing from the Data tab

The Analysis ToolPak add-in is not loaded.

  1. Select File > Options > Add-ins.
  2. Select Excel Add-ins in Manage, then Go.
  3. Tick Analysis ToolPak and select OK.

The ToolPak output counts one extra observation or shows an error

The header row was included in the range without ticking the labels option.

  1. Run the tool again.
  2. Tick the labels option, or start the ranges below the header row.

Results show on one sheet and other sheets get empty tables

Several worksheets were grouped when you ran the tool.

  1. Right-click a sheet tab and select Ungroup Sheets.
  2. Rerun the tool on each sheet separately.
Data Analysis missing in Excel: tick Analysis ToolPak in the Add-ins dialog
Open it from File > Options > Add-ins, select Excel Add-ins in Manage and Go, then tick Analysis ToolPak. (Image: Microsoft Q&A)

Excel t test FAQ

What is the formula for a t test in Excel?

The formula is =T.TEST(array1,array2,tails,type). Array1 and array2 are the two samples, tails is 1 or 2, and type is 1 for paired, 2 for two samples with equal variance or 3 for unequal variance. It returns the p-value.

How do I interpret T.TEST results in Excel?

The T.TEST result is a p-value. If it is below your significance level, usually 0.05, the difference between the two means is statistically significant. If it is 0.05 or higher, the data do not show a significant difference between the means.

What is the difference between a paired and a two-sample t test?

A paired t test compares two measurements of the same subjects, such as before and after values, and needs equal-sized ranges. A two-sample t test compares two separate groups, which can differ in size, with either equal or unequal variances assumed.

Should I use a one-tailed or two-tailed t test?

Use a two-tailed test unless you predicted the direction of the difference before seeing the data. In T.TEST, set tails to 2. The two-tailed p-value is double the one-tailed value, so it is the more cautious choice.

How do I find the t value in Excel?

Run a t-Test tool from Data > Data Analysis; the t Stat row of the output table is the t value. T.TEST only returns the p-value. For the critical t value, use =T.INV.2T(0.05,df) with your degrees of freedom.

Why is Data Analysis not showing in Excel?

The Analysis ToolPak add-in is not loaded. On Windows, select File > Options > Add-ins, choose Excel Add-ins in the Manage box, select Go and tick Analysis ToolPak. On a Mac, use Tools > Excel Add-ins and restart Excel.

What does a p-value of 0.05 mean in a t test?

A p-value of 0.05 means that, if the two population means were equal, a difference at least this large would appear about 5 percent of the time. Under the usual rule that p must be below alpha, a value of exactly 0.05 is not significant at alpha 0.05.

What is the difference between T.TEST and TTEST in Excel?

T.TEST is the current function and TTEST is the older version kept for compatibility with earlier Excel versions. Both take the same four arguments and return the probability associated with a Student's t-test. Use T.TEST in new workbooks.

Philip Celasco

Philip is a Texas-based technology writer and IT administrator at Techdows.com with more than 10 years of experience creating practical content for everyday users and professionals. He specializes in web browsers, particularly Chromium-based platforms such as Google Chrome, Microsoft Edge, Brave, and Opera. Through his work as an IT administrator, Philip has hands-on experience managing devices, configuring browser policies, troubleshooting software and network issues, and helping people resolve problems that affect productivity and security. His articles are based on practical testing and real-world technical experience. He covers browser settings, extensions, performance problems, privacy controls, security features, and Windows troubleshooting. Outside work, Philip enjoys the quieter side of life in Texas and stepping away from the screen when he can. He has two kids, two cats and loves to play golf with his mother during the weekends.

Leave a Reply

Your email address will not be published. Required fields are marked *