T.DIST.2T Function in Excel

Sumit Bansal
Written by

Sumit Bansal is the founder of TrumpExcel.com and a 13-time Microsoft Excel MVP. He started this site in 2013 to share his passion for Excel through easy tutorials, tips, and training videos, helping you master Excel, boost productivity, and maybe even enjoy spreadsheets!

The T.DIST.2T function in Excel returns a two-tailed probability from a t statistic and its degrees of freedom. You can use that probability as the p-value for a two-sided t-test.

A two-sided test checks for a difference in either direction, such as an average above or below a claimed value. T.DIST.2T includes both directions in its answer.

In this tutorial, I’ll show you four examples, including negative t statistics and a complete calculation from a small sample of commute times.

Follow along with the example file

T.DIST.2T Function Examples.xlsx

Download

T.DIST.2T Function Syntax

Here is the syntax of the T.DIST.2T function:

=T.DIST.2T(x,deg_freedom)
  • x is the nonnegative t statistic at which you want to calculate the probability. It can be a number, a cell reference, or a range of t statistics in Excel versions that support spilling.
  • deg_freedom is the number of degrees of freedom for the test. It must be at least 1, and the correct value depends on the type of t-test you are using.

Both arguments are required. T.DIST.2T uses x and deg_freedom together, so the same t statistic can give different probabilities with different degrees of freedom.

Excel drops the decimal part of deg_freedom. For example, 14.9 is treated as 14, so use the degrees of freedom required by your test rather than expecting Excel to keep a fractional value.

T.DIST.2T is available in Excel 2010 and later, including Microsoft 365 and Excel 2024, 2021, 2019, and 2016. The spilling examples below require Microsoft 365 or Excel 2021 or later.

When to Use the T.DIST.2T Function

Use this function when you need to:

  • Get a two-sided p-value from a t statistic you have already calculated.
  • Calculate p-values for several tests, each with its own degrees of freedom.
  • Finish a one-sample t-test after calculating the sample statistics.

Let me show you how these calculations work in Excel.

Example 1: Get a Two-Tailed p-Value

Let’s start with a test where the t statistic and degrees of freedom are already known.

Below is a summary of a package-weight test against a target weight, and I want its two-tailed p-value in B5.

Excel table showing t-statistic of 2.4 and 14 degrees of freedom for a package weight test two-tailed p-value calculation

Enter the below formula in cell B5:

=T.DIST.2T(B2,B3)
Excel formula bar showing =T.DIST.2T(B2,B3) with cell B5 displaying the resulting two-tailed p-value of 0.030869

The formula returns approximately 0.030869, or 3.09%. It uses the t statistic of 2.4 in B2 and the 14 degrees of freedom in B3.

For this test, the null hypothesis is that the population’s average package weight equals the target. The p-value describes how unusual a t statistic this far from zero would be if that hypothesis and the test’s assumptions held.

Specifically, it includes t values of 2.4 or higher and -2.4 or lower. Those are the two tails, and T.DIST.2T adds their probabilities together.

Important: A p-value of 3.09% does not mean there is a 3.09% chance that the null hypothesis is true. It describes the probability of a result at least this extreme under that hypothesis and the test’s assumptions.

The result is a probability, not a cutoff t statistic. If you chose a significance level of 0.05 before testing, compare 0.030869 directly with 0.05; the function has already included both tails, so you don’t divide its answer by two.

T.DIST.2T returns #NUM! if x is negative or the degrees of freedom are below 1. Nonnumeric text, such as a word entered in either input cell, gives a #VALUE! error.

Example 2: Calculate Several p-Values at Once

When you already have results for several tests, you can pass their t statistics and degrees of freedom to one formula.

Below are six store wait-time tests with their t statistics and degrees of freedom, and I want their two-tailed p-values in column D.

Excel table showing store locations, t-statistics, and degrees of freedom, with an empty column for two-tailed p-values

Enter the below formula in cell D2:

=T.DIST.2T(B2:B7,C2:C7)
Excel formula =T.DIST.2T(B2:B7,C2:C7) calculating two-tailed p-values for store wait-time t-statistics and degrees of freedom

The formula spills six results down column D. It pairs each t statistic in B2:B7 with the degrees of freedom on the same row in C2:C7.

For example, Central’s t statistic of 2.5 and 14 degrees of freedom produce approximately 0.025467. North’s smaller t statistic of 1.7, with 9 degrees of freedom, gives approximately 0.123348.

Each row represents a separate test. These calculations turn existing test statistics into p-values; they don’t calculate t statistics from the stores’ original wait-time observations.

Make sure D3:D7 are empty before entering the formula. If one of those cells contains something, Excel returns a #SPILL! error because it cannot place all six answers.

If you are using Excel 2019 or earlier, enter the below formula in cell D2 and copy it down to D7:

=T.DIST.2T(B2,C2)

Example 3: Use a Negative t Statistic

A t statistic can be negative when a sample result is below the value being tested. For a two-sided test, its distance from zero matters in either direction.

Below are fitness-class test results with positive and negative t statistics, and I want their two-tailed p-values in column D.

Excel table with fitness class names, signed t-statistics, and degrees of freedom, with an empty p-value column

Enter the below formula in cell D2:

=T.DIST.2T(ABS(B2:B7),C2:C7)
Excel formula =T.DIST.2T(ABS(B2:B7),C2:C7) calculating two-tailed p-values for fitness class t-statistics in column D

The ABS function removes the minus sign from each negative t statistic before T.DIST.2T uses it. Positive values and zero stay as they are.

Cycling has a t statistic of -2.6, while Swimming has 2.6. Both have 19 degrees of freedom, so they return the same two-tailed p-value of approximately 0.017585.

Dance has a t statistic of zero and returns 1.000000. Every possible t value is at least zero units away from zero, so the combined probability is 100%.

Important: Passing a negative t statistic directly to T.DIST.2T gives a #NUM! error. Use ABS for this two-sided calculation, where equally large positive and negative statistics count as equally extreme.

Keep the original signed statistics in column B. The formula uses their magnitudes to calculate the probabilities, while the original signs still show the direction of the differences.

If you are using Excel 2019 or earlier, enter the below formula in cell D2 and copy it down to D7:

=T.DIST.2T(ABS(B2),C2)

Follow along with the example file

T.DIST.2T Function Examples.xlsx

Download

Example 4: Run a One-Sample t-Test

So far, the t statistics were already available. This time, let’s calculate one from the observations and use T.DIST.2T for the final p-value.

A one-sample t-test compares a population mean with a specified value. Here, the null hypothesis is that the population’s mean commute time is 30 minutes, and the two-sided alternative is that it differs from 30 minutes.

These are made-up observations to demonstrate the calculation. For a real small-sample test, use independent observations from an approximately normal population; the formula cannot check those assumptions for you.

Below are ten commute times with a claimed mean of 30 minutes in E2, and I want the test’s two-tailed p-value in E8.

Excel table showing commute trip data and a template for a one-sample t-test with a claimed mean of 30 minutes

First, use the COUNT function in cell E3 to get the number of numeric observations:

=COUNT(B2:B11)
Excel formula bar showing =COUNT(B2:B11) to calculate sample size in cell E3 for a one-sample t-test data table

This returns 10. Use numeric times throughout the sample, because COUNT ignores text and blank cells in a range.

Next, use the AVERAGE function to calculate the sample mean in cell E4:

=AVERAGE(B2:B11)
Excel formula bar showing =AVERAGE(B2:B11) to calculate the sample mean in a one-sample t-test table

The sample mean is 32.00 minutes. That is 2 minutes above the claimed mean, but the test also needs to account for the variation between observations.

Calculate the sample standard deviation in cell E5:

=STDEV.S(B2:B11)
Excel formula bar showing STDEV.S(B2:B11) to calculate sample standard deviation for one-sample t-test data

This returns approximately 2.581989 minutes. The STDEV.S function estimates the variation using the sample, which is what this test needs.

Now calculate the t statistic in cell E6:

=(E4-E2)/(E5/SQRT(E3))
Excel formula =(E4-E2)/(E5/SQRT(E3)) calculating a t-statistic in cell E6 for a one-sample test of commute times

How this formula works:

  • E4-E2 subtracts the claimed mean of 30 from the sample mean of 32.
  • E5/SQRT(E3) calculates the estimated standard error, which measures the uncertainty in the sample mean. It divides the sample standard deviation by the square root of the sample size.
  • Dividing the difference by that standard error gives the t statistic, approximately 2.449490.

For this one-sample test, the degrees of freedom are the sample size minus one. Enter the below formula in cell E7:

=E3-1
Excel formula bar showing =E3-1 with cell E7 selected in a one-sample t-test table calculating degrees of freedom

This gives 9 degrees of freedom. The sample-size-minus-one rule belongs to this one-sample test; other types of t-tests can use a different calculation.

Finally, calculate the two-tailed p-value in cell E8:

=T.DIST.2T(ABS(E6),E7)
Excel formula bar showing T.DIST.2T function calculating two-tailed p-value for a one-sample t-test using t-statistic E6

The formula returns approximately 0.036787, or 3.68%. ABS also keeps the formula working if you change the sample or claimed mean and the t statistic becomes negative.

If you chose a 5% significance level before looking at the results, 0.036787 is below 0.05. You would reject the null hypothesis of a 30-minute population mean, provided the test’s assumptions hold.

This is one test on one sample, so it produces one p-value. The two spilling examples above instead start with several separate test statistics and produce one p-value for each.

So these are four ways to use the T.DIST.2T function, starting with a known t statistic and finishing with a one-sample calculation from the original observations.

I hope you found this article helpful.

List of All Excel Functions

Other Excel Articles You May Also Like:

Sumit Bansal

Sumit Bansal

13x Microsoft Excel MVP

Hey! I'm Sumit Bansal, founder of trumpexcel.com and a Microsoft Excel MVP. I started this site in 2013 because I genuinely love Microsoft Excel (yes, really!) and wanted to share that passion through easy Excel tutorials, tips, and Excel training videos. My goal is straightforward: help you master Excel skills so you can work smarter, boost productivity, and maybe even enjoy spreadsheets along the way!

Get the FREE 51 Excel Tips Ebook

Enter your details and the free PDF is on its way to your inbox.

Hmm, that didn't go through. Please check your email and try again.

No spam. You'll also get my weekly Excel newsletter. Unsubscribe anytime.

Check your inbox!

The ebook is on its way to your email. It usually lands within a couple of minutes.