P Value in Excel: Formulas for Common Statistical Tests

Formulas & functions · Updated November 21, 2026

To calculate a p value in Excel, choose a test that matches your data, then use its worksheet function or calculate the test statistic and pass it to a distribution function. For a one-sample, two-sided t test, for example, with measurements in A2:A7 and a hypothesized mean of 10, enter =T.DIST.2T(ABS((AVERAGE(A2:A7)-10)/(STDEV.S(A2:A7)/SQRT(COUNT(A2:A7)))),COUNT(A2:A7)-1); the example data 12, 11, 9, 13, 10, and 12 give a p value of about 0.110.

What a p value means

A p value is the probability, assuming a specified null hypothesis and its assumptions are true, of observing a result at least as unusual as the one obtained. It is not the probability that the null hypothesis is true, nor does it measure the size or practical importance of an effect. A small p value can be evidence against the null hypothesis, but it does not by itself explain why a result occurred.

Excel does not have one universal p-value formula because a p value depends on the statistical test. A comparison of two group means, a count table, and a correlation each use different test statistics and reference distributions. Before entering a formula, identify the question, the null hypothesis, whether observations are independent or paired, and whether the test should be one-sided or two-sided.

For instance, the example in the opening tests whether the population mean differs from 10. Its sample mean is 11.167, its sample standard deviation is about 1.472, and the t statistic is about 1.941 with 5 degrees of freedom. The resulting two-sided p value is about 0.110. That is not below the commonly chosen 0.05 threshold, but the threshold is a convention, not a boundary between an effect being real and unreal.

Choose the test before writing a formula

The data structure determines which Excel function is appropriate. A common mistake is choosing a formula because it is familiar, rather than because its assumptions fit the study design. Use these distinctions as a starting point:

  • One sample mean: Compare a sample mean with a specified value using a one-sample t statistic. Excel does not provide a dedicated one-sample t-test worksheet function, so calculate the statistic and use a t-distribution function.
  • Two independent means: Use T.TEST for two groups whose observations are not paired. Decide whether equal population variances are reasonable; the unequal-variance version is often the safer default when that assumption is uncertain.
  • Paired measurements: Use the paired option in T.TEST when each observation in one range matches a particular observation in the other, such as before-and-after measurements on the same people.
  • Counts in categories: Use CHISQ.TEST to compare observed counts with expected counts under a specified categorical null model.
  • Population mean with known standard deviation: A z test may apply. Excel’s Z.TEST returns a one-tailed probability; verify that its assumptions and tail match the question.

Do not treat paired data as independent or assume equal variances without a reason. Those choices change the test statistic and its p value, even when the same raw numbers are used.

Calculate a one-sample t-test p value

For a one-sample test, calculate the difference between the sample mean and hypothesized mean in standard-error units. Excel’s T.DIST.2T converts the absolute t statistic and degrees of freedom into a two-sided p value. This is useful when comparing one sample to a target, such as checking whether a process average differs from a stated value.

With the six example measurements in A2:A7 and the null mean 10, enter this formula in an empty cell:

=T.DIST.2T(ABS((AVERAGE(A2:A7)-10)/(STDEV.S(A2:A7)/SQRT(COUNT(A2:A7)))),COUNT(A2:A7)-1)

The arithmetic is: sample mean 67/6 = 11.1667; sample standard deviation about 1.472; standard error about 1.472 divided by the square root of 6, or 0.601; and t about (11.1667 – 10)/0.601 = 1.941. The degrees of freedom are 6 – 1 = 5. Excel returns approximately 0.110 for the two-sided test. Small differences in the last displayed digits can occur because of rounding.

The formula uses STDEV.S, because the sample standard deviation estimates population variability from a sample, and COUNT to count numeric observations. If the hypothesized mean is stored in D1 instead of typed as 10, replace 10 in the formula with D1. Ensure that the range contains only the intended numeric observations; blank cells and text are not counted by COUNT.

For a one-sided test, the direction must be specified in advance. The two-sided formula above should not be halved after seeing which direction the data went. A one-sided calculation uses a single tail of the t distribution and is appropriate only when the research question and analysis plan genuinely rule out the opposite direction.

Use T.TEST to compare two groups

For two groups, Excel’s T.TEST returns the p value directly. It takes the first data range, second data range, number of tails, and test type. The tails argument is 1 for a one-sided test or 2 for a two-sided test. The type argument is 1 for paired data, 2 for a two-sample equal-variance test, and 3 for a two-sample unequal-variance test.

With independent group measurements in A2:A11 and B2:B11, and a two-sided test that does not assume equal variances, enter =T.TEST(A2:A11,B2:B11,2,3). Excel calculates and returns the p value. If each value in A is matched to the value in the same row in B, use type 1 instead: =T.TEST(A2:A11,B2:B11,2,1). These formulas only make sense when the ranges are aligned and contain the intended numeric observations.

Use type 2 only when the equal-variance assumption is justified for the independent groups. Type 3 is Welch’s t test, which allows the two populations to have different variances. For paired data, the key assumption concerns the distribution of within-pair differences, not whether the two separate columns have equal variances. Choose one or two tails based on the hypothesis, not on which result looks more favorable.

Other Excel functions that return p values

Excel has specific functions for several other standard tests. Their inputs need to represent the quantities the test expects, rather than raw values in arbitrary form.

  • Chi-square test: CHISQ.TEST(actual_range, expected_range) returns a p value comparing observed and expected counts. For example, with observed counts in B2:B4 and expected counts in C2:C4, use =CHISQ.TEST(B2:B4,C2:C4). Expected counts must correspond to the same categories and be calculated from the null model. Very small expected counts can make the usual chi-square approximation unreliable.
  • F test for variances: F.TEST(array1,array2) returns the two-tailed probability for the F test of whether two samples have the same variance. With two samples in A2:A11 and B2:B11, use =F.TEST(A2:A11,B2:B11). It is sensitive to departures from normality, so it should not be used as a generic check that two means differ.
  • Z test: Z.TEST(array,x,[sigma]) returns a one-tailed p value for a hypothesized population mean x; sigma is the known population standard deviation and is optional in the function. With observations in A2:A21, a hypothesized mean in D1, and a known population standard deviation in D2, use =Z.TEST(A2:A21,D1,D2). If sigma is omitted, Excel uses the sample standard deviation. Check the tail and the direction carefully before interpreting the result.

Function names may appear in older workbooks as legacy names such as FTEST or ZTEST. In current Microsoft 365 Excel for Windows, use the dotted names shown above. Excel for Mac and Excel for the web generally support these worksheet functions as well, though ribbon layout and dialog placement can differ.

One-tailed versus two-tailed tests

A two-tailed test asks whether a result differs in either direction from the null value. A one-tailed test asks whether it differs in one specified direction. If a treatment could plausibly raise or lower an outcome, the two-tailed test is normally the relevant question. If a one-tailed hypothesis is chosen only after observing the data, the reported p value is misleadingly small.

For Excel functions that offer a tails argument, such as T.TEST, set it directly to 1 or 2. For distribution functions, make sure the correct tail calculation is used: T.DIST.2T is for two-sided t probabilities, while T.DIST.RT gives a right-tail t probability. The test statistic’s sign and the scientific direction matter when using a one-tail result.

Check the result and avoid common errors

A p value should be interpreted in the context of the design, assumptions, and effect estimate. A value of 0.03 does not mean there is a 3% chance the null hypothesis is true. It means that, under the null model and its assumptions, results at least as extreme as the observed result would occur with probability 0.03. It also does not show whether an effect is large enough to matter in practice.

  • Check that numeric data are in the intended ranges and that headers, totals, missing values, or duplicated records have not been included accidentally.
  • Check that the observations are independent where the test requires independence, and use a paired test for genuinely matched observations.
  • Confirm the tail, variance assumption, and null hypothesis. A function can return a number even when those choices are inappropriate.
  • Report the effect estimate and, when relevant, a confidence interval alongside the p value. Statistical significance alone is not a measure of magnitude.
  • If many tests are run, account for multiple comparisons as appropriate. Repeating tests and highlighting only small p values increases the chance of false positives.

Excel displays a decimal p value. You can show more decimal places with Home > Number, or format the cell as Percentage if that presentation is useful; formatting does not change the underlying value. A result displayed as 0.000 may simply be smaller than the displayed precision, not exactly zero. Increase decimal places or use scientific notation rather than reporting it as p = 0.

Frequently Asked Questions

What is the Excel formula for a p value?
There is no single formula for every test. Use T.TEST for a two-sample t test, CHISQ.TEST for observed versus expected counts, or calculate a test statistic and use the appropriate distribution function for a test such as a one-sample t test.

How do I calculate a p value from a t statistic in Excel?
For a two-sided t test, use =T.DIST.2T(ABS(t_statistic),degrees_freedom), replacing the labels with cell references or numeric values. For a one-sample test, degrees of freedom are the sample size minus one.

Can Excel calculate a one-sample t test?
Excel does not provide a dedicated one-sample t-test function. Calculate the t statistic from the sample mean, hypothesized mean, sample standard deviation, and sample size, then use T.DIST.2T for a two-sided result or the appropriate one-tail t distribution function.

Should I use T.TEST type 1, 2, or 3?
Use type 1 for matched pairs, type 2 for independent samples with an equal-variance assumption, and type 3 for independent samples without that assumption. The study design determines whether values are paired; it is not a choice based on which p value is smaller.

Why does Excel show a p value of 0.000?
The value may be very small and rounded to three decimal places. Increase the displayed precision or use scientific notation. A finite test result is generally not exactly zero, and a rounded display should not be reported as proof of certainty.

Does a p value below 0.05 prove an effect?
No. It indicates that the result would be relatively unusual under the null hypothesis and test assumptions. It does not establish causation, quantify practical importance, or give the probability that the null hypothesis is true.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.