Excel Z-Test: How to Calculate and Interpret Results

How-to basics · Updated November 21, 2026

To run a one-sample z-test in Excel, calculate a z-score using the sample mean, hypothesized mean, known population standard deviation, and sample size, then convert it to a p-value. With the sample mean in B2, hypothesized mean in B3, known population standard deviation in B4, sample size in B5, and z-score in B6, enter =(B2-B3)/(B4/SQRT(B5)) in B6 and =2*(1-NORM.S.DIST(ABS(B6),TRUE)) in B7 for a two-sided p-value.

What a z-test answers

A z-test evaluates whether sample data are far enough from a stated population value to count as evidence against a null hypothesis. The z-score expresses the distance between the observed result and the value predicted by the null hypothesis in standard-error units. A z-score near zero means the observation is close to the null value; a large positive or negative score means it is farther away.

The p-value measures how unusual a result at least as extreme as the observed one would be if the null hypothesis were true. It is not the probability that the null hypothesis is true. For example, a p-value of 0.0455 means that results this extreme or more extreme would occur about 4.55% of the time under the null model, assuming the test’s conditions hold.

A z-test is not simply a way to standardize any number. The test also depends on the study design, a suitable sampling distribution, and usually a known population standard deviation for a test of a mean. Picking the right test matters as much as entering a correct formula.

When to choose a z-test

Use a one-sample z-test for a population mean when the population standard deviation is known and the sampling distribution of the mean is approximately normal. This is a relatively specific situation: in many practical studies, the population standard deviation is not known, so a one-sample t-test is more appropriate.

For a population proportion, a z-test can be appropriate when observations are independent and the normal approximation is reasonable. A two-proportion z-test compares the proportions in two independent groups. By contrast, a paired study, such as measuring the same people before and after an intervention, calls for an analysis that accounts for the pairing rather than treating the samples as independent.

  • One mean: compare a sample mean with a specified population mean; the population standard deviation should be known for the classic z-test.
  • One proportion: compare a sample proportion with a specified proportion, subject to the normal-approximation conditions.
  • Two means: compare independent group means; the standard two-sample z procedure assumes known population variances.
  • Two proportions: compare the observed rates in two independent groups using a pooled estimate under the null hypothesis.

Set up the worksheet and calculate a mean test

For a transparent one-sample example, suppose a process has a claimed mean of 50 units. A sample of 36 items has a mean of 52, and the population standard deviation is known to be 6 units. Put those values in B2 through B5 as described in the opening paragraph. The calculated standard error is 6 divided by the square root of 36, or 1 unit, so the z-score is 2.

The p-value formula in the opening calculates the two-sided probability. With a z-score of 2, it returns approximately 0.0455. At a significance level of 0.05, this is below the cutoff, so the result is statistically significant under the test assumptions. It does not establish that the difference is important in practice, nor does it prove the process mean is not 50.

To calculate the two-sided 95% confidence interval for the population mean in the same example, with the sample mean in B2, population standard deviation in B3, sample size in B4, and confidence level 0.95 in B5, enter =B2-NORM.S.INV(1-(1-B5)/2)*B3/SQRT(B4) for the lower limit and =B2+NORM.S.INV(1-(1-B5)/2)*B3/SQRT(B4) for the upper limit. The results are approximately 50.04 and 53.96. This interval is related to a two-sided test at the 5% level: the hypothesized mean of 50 falls just outside it.

In a real worksheet, label each input with its meaning and units, and keep the raw observations separate from the summary cells. If you calculate the sample mean from raw data, record the exact range used; blanks and text entries can affect how Excel counts observations. Do not substitute the sample standard deviation for the known population standard deviation and still call the result the classic z-test.

Choose the correct p-value for the hypothesis

The direction of the alternative hypothesis determines whether the test is one-sided or two-sided. A two-sided test asks whether the mean differs in either direction. A right-sided test asks whether it is greater than the null value, and a left-sided test asks whether it is smaller. Decide this based on the research question before examining results; choosing a tail afterward to get a smaller p-value is not a sound testing procedure.

For a right-sided test, with the z-score in B6, enter =1-NORM.S.DIST(B6,TRUE). For a left-sided test with the same layout, enter =NORM.S.DIST(B6,TRUE). The two-sided formula uses the absolute z-score and doubles the probability in the upper tail. Excel’s TRUE argument requests the cumulative standard normal probability; omitting it would request the density rather than the cumulative probability.

Set a significance level, often 0.05, before making a decision. Compare the p-value with that level, but report the actual p-value and an estimate of the effect as well. Statistical significance depends partly on sample size: a very small difference can be significant in a large sample, while a meaningful difference can be uncertain in a small one.

Test a single proportion in Excel

For a proportion example, suppose 54 of 100 inspected items meet a standard and the null hypothesis says the pass rate is 50%. With the number of successes in B2, sample size in B3, and hypothesized proportion in B4, enter =(B2/B3-B4)/SQRT(B4*(1-B4)/B3) in B5. It returns a z-score of 0.8. With that z-score in B5, enter =2*(1-NORM.S.DIST(ABS(B5),TRUE)) in B6 for a two-sided p-value of approximately 0.4237.

This is not the same standard-error calculation as a mean test. For the one-proportion test, the standard error is based on the hypothesized proportion under the null. The normal approximation is most credible when the expected numbers of successes and failures under that hypothesis are sufficiently large; a common practical check is at least 10 of each, though conventions and exact methods can differ. For small counts, consider an exact binomial test rather than relying on a normal approximation.

Use Excel’s two-sample z-test tool

Excel for Microsoft 365 on Windows includes a ToolPak command named z-Test: Two Sample for Means. It tests the difference between two means when the population variances are known. It is not a general button for every kind of z-test, and it is not the same as a two-proportion test. The tool asks for two data ranges and the known variance for each population; variances are standard deviations squared.

If Data Analysis is not visible on the Data tab in Windows, enable the add-in through File > Options > Add-ins. Choose Excel Add-ins in the Manage box, select Go, check Analysis ToolPak, and confirm. Then open Data > Data Analysis, select z-Test: Two Sample for Means, provide the input ranges and population variances, choose an output location, and run the analysis. Check that the tool’s one-tail or two-tail p-value matches the alternative hypothesis you planned to test.

In Excel for Mac, enable the ToolPak through Tools > Excel Add-ins, then look for Data Analysis on the Data tab. Excel for the web does not provide the same desktop ToolPak workflow; cell formulas are a practical alternative there. ToolPak output can be convenient for a two-mean comparison, but formulas make assumptions visible and are easier to adapt to one-sample or proportion tests.

Assumptions and common mistakes

  • Using a t-test situation as a z-test: if the population standard deviation is unknown and estimated from the sample, a t-test is generally the relevant mean test. A large sample alone does not make an unknown standard deviation known.
  • Ignoring dependence: repeated measurements, matched pairs, or clustered observations are not independent samples. Use a method that reflects the data structure.
  • Assuming normality without considering the data: for means, a normal population or a sufficiently well-behaved sampling distribution supports the usual procedure. Strong skew, outliers, or a small sample may require more care.
  • Confusing standard deviation and standard error: the standard error describes uncertainty in a sample statistic and depends on sample size. Entering the population standard deviation directly where the standard error belongs gives the wrong z-score.
  • Misreading statistical significance: a small p-value is not a measure of effect size, practical value, or the probability the result is due to chance in an unrestricted sense.

For a two-sample mean test, confirm that the samples are independent and that the variances supplied to the ToolPak really are population variances. If those variances are estimated from the sample, or if the data are paired, another procedure may be more suitable. Also check for missing values, data-entry errors, and inconsistent units before interpreting any output.

Alternatives and useful Excel functions

If the population standard deviation is unknown, consider a one-sample t-test; for independent means, a two-sample t-test may fit the design. Excel includes the T.TEST function for comparing two arrays, but that function does not directly perform a one-sample t-test. For a proportion with small expected counts, an exact binomial approach is often preferable. For paired data, use a paired test rather than an independent-samples test.

Excel’s NORM.S.DIST function converts a standard normal z-score to a cumulative probability, while NORM.S.INV converts a cumulative probability to a standard normal cutoff. These functions are available in current Excel versions. STANDARDIZE can also produce a standardized value from an observation, mean, and standard deviation, but it does not by itself perform a hypothesis test or determine the correct standard error for your study. The choice of test and the setup of its inputs remain your responsibility.

Frequently Asked Questions

Does Excel have a built-in z-test function?
Excel has a ToolPak analysis command for a two-sample z-test of means with known population variances, but there is no single general worksheet function that performs every z-test. You can calculate a z-score and p-value with formulas, using the appropriate test-specific standard error.

What is the Excel formula for a two-tailed z-test?
With a calculated z-score in B6, use =2*(1-NORM.S.DIST(ABS(B6),TRUE)). This gives a two-sided p-value for a standard normal test statistic. The formula does not decide whether the z-test assumptions are appropriate.

Should I use a z-test or a t-test?
For a test of a mean, use a z-test when the population standard deviation is known and the distributional conditions are suitable. When it is unknown and estimated from the sample, a t-test is generally appropriate. Proportion tests have different conditions, so do not choose between z and t based on a rule about sample size alone.

How do I interpret a z-score of 2?
It means the observed statistic is two standard errors above the value expected under the null hypothesis. If the test is two-sided, the standard normal p-value is about 0.0455. The interpretation depends on the model, test direction, and assumptions.

Can I run a z-test in Excel for the web?
You can use worksheet formulas such as NORM.S.DIST to calculate test results. The desktop Analysis ToolPak workflow is not available in the same way in Excel for the web, so use formulas or a compatible desktop version for that add-in command.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

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

Spotted an error in this guide? Let us know.