How to Determine P Value in Excel: Step-by-Step Guide
In this article
To determine a p value in Excel, you use a built-in statistical function that matches your test type. For a t-test, use T.TEST (or TTEST in older versions); for a z-test, use NORM.S.DIST; for a chi-square test, use CHISQ.DIST.RT; and for an F-test, use F.DIST.RT. Each function returns the p value directly when you supply the right arguments. This guide walks through each common scenario, explains the arguments, and covers the mistakes that produce wrong results.
What You'll Need
- Microsoft Excel (any recent version; function names differ slightly in Excel 2007 and earlier).
- Your data in two columns or ranges — one for each group or variable.
- A basic understanding of which test fits your question (t-test, z-test, chi-square, or F-test).
Step-by-Step
- Identify your test type. Compare two group means with a t-test. Compare a sample mean to a known population mean with a z-test (when population standard deviation is known). Test independence in a contingency table with a chi-square test. Compare variances with an F-test. The function you choose depends on this.
- Arrange your data. For a t-test, put each group's values in separate columns (e.g., A2:A20 and B2:B20). For a z-test, you need the sample mean, population mean, population standard deviation, and sample size. For chi-square, build a contingency table with observed counts. For F-test, put the two samples in separate columns.
- Enter the function for a t-test. Click an empty cell and type
=T.TEST(array1, array2, tails, type). Replacearray1andarray2with your ranges (e.g., A2:A20, B2:B20). Settailsto 1 for a one-tailed test or 2 for a two-tailed test. Settypeto 1 for paired, 2 for two-sample equal variance, or 3 for two-sample unequal variance (Welch). Press Enter. The result is the p value. - Enter the function for a z-test. Excel has no direct z-test p-value function, so compute it manually. In a cell, type
=2*(1-NORM.S.DIST(ABS((sample_mean-population_mean)/(population_sd/SQRT(n))),TRUE))for a two-tailed test. Replace the placeholders with cell references or numbers. For a one-tailed test, drop the leading 2 and the absolute value, and use=1-NORM.S.DIST((sample_mean-population_mean)/(population_sd/SQRT(n)),TRUE)if the alternative is “greater than,” or=NORM.S.DIST((sample_mean-population_mean)/(population_sd/SQRT(n)),TRUE)if “less than.” - Enter the function for a chi-square test. First compute the chi-square statistic. If you have a contingency table, use
=CHISQ.TEST(observed_range, expected_range)where expected_range contains the expected frequencies you calculate (row total × column total / grand total). CHISQ.TEST returns the p value directly. Alternatively, compute the statistic manually and use=CHISQ.DIST.RT(chi_square_stat, degrees_of_freedom). - Enter the function for an F-test. Use
=F.TEST(array1, array2)to get the two-tailed p value for equal variances. For a one-tailed test, use=F.DIST.RT(F_stat, df1, df2)or=F.DIST(F_stat, df1, df2, TRUE)depending on the direction. F.TEST is the simplest for comparing variances. - Interpret the result. A p value below your significance level (commonly 0.05) suggests rejecting the null hypothesis. Above it, you fail to reject. Always state the test and significance level alongside the p value.
- Verify with the Data Analysis ToolPak (optional). Enable it via File > Options > Add-ins > Excel Add-ins > Go > Analysis ToolPak. Then use Data > Data Analysis to run t-tests, z-tests, F-tests, and chi-square tests, which output p values in a table. Labels can differ slightly by Excel version and platform.
Common Mistakes
- Using the wrong test type. A paired t-test (type 1) on independent groups inflates or deflates the p value. Match the type to your design.
- Forgetting tails. A two-tailed test doubles the one-tailed p value. Decide before looking at the data.
- Mismatched ranges. T.TEST requires equal-sized arrays for paired tests; unequal sizes are allowed for two-sample tests but must be correct.
- Using TTEST instead of T.TEST. Both work in modern Excel, but TTEST is compatibility-only. Use T.TEST for new sheets.
- Ignoring assumptions. T-tests assume roughly normal data; chi-square expects adequate expected counts. Violations make the p value unreliable.
- Hard-coding numbers instead of cell references. This makes updates error-prone. Reference cells so the p value recalculates when data changes.
Tips
- Use named ranges (Formulas > Define Name) to make formulas readable, e.g.,
=T.TEST(GroupA, GroupB, 2, 3). - Format the p-value cell to show more decimals (e.g., 0.0000) so small values are visible.
- For a quick two-tailed t-test, the ToolPak output includes both one- and two-tail p values; read the correct row.
- Document the test, tails, and type in a nearby cell so the result is reproducible.
- If you need exact p values for non-standard tests, consider the Real Statistics add-in or use Excel's built-in functions for the standard cases.
Troubleshooting
- #NUM! error: Check that arrays contain numbers, not text, and that standard deviations are positive. For T.TEST, ensure tails is 1 or 2 and type is 1, 2, or 3.
- #VALUE! error: A range may include empty cells or text. Clean the data or use functions that ignore blanks.
- Unexpectedly high or low p value: Recheck the test type and tails. Also verify that you haven't swapped groups or used the wrong standard deviation.
- Function not recognized: In Excel 2007 or earlier, use TTEST, CHITEST, FTEST, NORMSDIST instead. Update Excel if possible.
- ToolPak missing: Re-enable it via File > Options > Add-ins. On Mac, use Tools > Excel Add-ins.
Frequently Asked Questions
What is the difference between T.TEST and TTEST?
T.TEST is the modern function name; TTEST is the legacy name kept for compatibility. Both return the same result. Use T.TEST for new work.
Can I get a p value for a z-test directly in Excel?
No single function does it. Compute the z statistic and use NORM.S.DIST as shown in the steps.
How do I know whether to use a one-tailed or two-tailed test?
Use two-tailed when you test for any difference; use one-tailed when you predict a direction (greater or less). Decide before analyzing data.
Why does my p value differ from SPSS or R?
Check the test type, tails, and whether you used equal or unequal variances. Small differences can also come from rounding or missing values.
Can I calculate a p value for a correlation in Excel?
Yes. Use =T.DIST.2T(ABS(r)*SQRT((n-2)/(1-r^2)), n-2) where r is the correlation coefficient and n is the sample size.
What significance level should I use?
0.05 is conventional, but choose based on your field and consequences of error. Report the level you used.