Written and maintained by CASRAI Editorial Board
Published
On this page
To run a z test in Excel, use the Z.TEST function: =Z.TEST(array, x, [sigma]) returns the one-tailed p-value for the hypothesis that the population mean equals x, and you double the smaller tail to get a two-tailed p-value. Excel has no function that returns the z statistic or the critical z for this test, so those come from AVERAGE, NORM.S.DIST and NORM.S.INV. This guide shows each step with Microsoft’s own example data, reproduces the Z.TEST result by hand so you can see what it computes, and covers critical z, a one-sample proportion z test and the Analysis ToolPak.
What Z.TEST is used for in research
A one-sample z test asks whether the mean of one sample is compatible with a stated population mean. Microsoft’s documentation describes Z.TEST as returning the one-tailed probability-value of a z test: the probability, if the population mean is the hypothesized value, that a sample mean would exceed the observed average. In research this is the check you run when a reference value exists (a published standard, a calibration target, a historical mean) and you want to know whether your measurements depart from it.
The z test assumes the population standard deviation is known, or the sample is large enough that using the sample standard deviation is an acceptable approximation. When neither holds, a t test is the usual choice; the comparison in z test vs t test sets out when each applies. For the distribution functions behind the test, see the z distribution in Excel.
How to access Z.TEST in Excel
Z.TEST is a built-in worksheet function, so nothing needs installing. Microsoft lists it as available in Excel for Microsoft 365 (Windows, Mac and web), Excel 2024, 2021, 2019 and 2016. Type it into any cell.
The separate z-Test tool for two samples lives in the Analysis ToolPak add-in, which is not loaded by default. Microsoft’s instructions for loading it:
- On Windows, select File, Options, Add-Ins. In the Manage box select Excel Add-ins and choose Go. Tick Analysis ToolPak and select OK. If it is not listed, select Browse to locate it.
- On Mac, open the Tools menu, choose Excel Add-ins, tick Analysis ToolPak and select OK.
How to do a z test in Excel step by step
The steps below use the data Microsoft publishes with the Z.TEST article: ten values entered in cells A2:A11 (3, 6, 7, 8, 6, 5, 4, 2, 1, 9). The question is whether the population mean could be 4.
- Enter the ten values in A2:A11 and state your hypotheses: H0 is that the population mean equals 4, H1 that it does not.
- In an empty cell enter
=Z.TEST(A2:A11,4). Excel returns 0.090574. This is the one-tailed p-value. - For a two-tailed test, enter
=2 * MIN(Z.TEST(A2:A11,4), 1 - Z.TEST(A2:A11,4)). Excel returns 0.181148, the two-tailed p-value Microsoft gives for a hypothesized mean of 4. - Compare the p-value with your significance level α. At α = 0.05, 0.181148 is larger, so there is no evidence against a population mean of 4.
- If you know the population standard deviation, add it as the third argument, for example
=Z.TEST(A2:A11,4,2.5). The 2.5 here is a placeholder to show the syntax, not a value from the example.
Why the one-tailed value can be misleading
Z.TEST always reports the upper tail. Microsoft states that if AVERAGE(array) is less than x, the result is greater than 0.5. Testing the same data against a hypothesized mean of 6 shows it: =Z.TEST(A2:A11,6) returns 0.863043, which looks like a large p-value only because the sample mean (5.1) lies below 6. The two-tailed formula returns 0.273913 for that case. Reading the raw Z.TEST value as a two-sided p-value is the most common error with this function. Fix the tail before you see the data, not after.
Reproduce Z.TEST by hand to see what it does
Microsoft gives the formula that Z.TEST evaluates: with sigma supplied, 1 - NORM.S.DIST((AVERAGE(array) - x) / (sigma / SQRT(n)), TRUE), where n is the number of values. When sigma is omitted, the documentation substitutes STDEV(array) for sigma. For the example data:
- AVERAGE(A2:A11) = 5.1 and n = 10.
- STDEV(A2:A11) = 2.6013, so the standard error is 2.6013 / SQRT(10) = 0.8226.
- For x = 4: z = (5.1 – 4) / 0.8226 = 1.3372, and
=1-NORM.S.DIST(1.3372,TRUE)returns 0.0906, matching Z.TEST. - For x = 6: z = (5.1 – 6) / 0.8226 = -1.0941, and
=1-NORM.S.DIST(-1.0941,TRUE)returns 0.8630, matching Z.TEST.
Because the sample standard deviation was used here, this is an approximation to a true z test, which needs a known population standard deviation. With only ten observations a t test would normally be preferred; Z.TEST with no sigma argument gives the large-sample answer.
How to find the critical z in Excel
Use NORM.S.INV, which returns the inverse of the standard normal cumulative distribution: NORM.S.INV(probability). Give it the cumulative probability to the left of the cutoff. A probability of 0 or less, or 1 or more, returns #NUM!, and a non-numeric argument returns #VALUE!.
- One-tailed, right tail, α = 0.05:
=NORM.S.INV(1-0.05)gives 1.6449. - Two-tailed, α = 0.05:
=NORM.S.INV(1-0.05/2)gives 1.9600; reject H0 when |z| exceeds it. - Two-tailed, α = 0.01:
=NORM.S.INV(1-0.01/2)gives 2.5758.
Microsoft’s own check of the function is =NORM.S.INV(0.908789), which returns 1.3333347; NORM.S.DIST reverses it, since =NORM.S.DIST(1.333333,TRUE) returns 0.908788726. The values above were computed with the standard normal distribution and agree with these functions.
What is the formula for a to z in Excel?
If the question means converting a significance level α (alpha) into a z value, the formula is =NORM.S.INV(1-α) for a one-tailed test and =NORM.S.INV(1-α/2) for a two-tailed one, as above. Going the other way, from a z value to a p-value, use =1-NORM.S.DIST(z,TRUE) for the upper tail and =2*(1-NORM.S.DIST(ABS(z),TRUE)) for a two-tailed p-value.
How to do a proportion z test in Excel
Excel has no built-in function for a proportion z test, so you build it from the formula z = (p̂ − p0) / SQRT(p0 × (1 − p0) / n), where p̂ is the observed proportion, p0 the hypothesized proportion and n the sample size, then take the p-value from NORM.S.DIST. This is a standard large-sample test; check that n × p0 and n × (1 − p0) are both comfortably large before relying on it.
An illustrative example (invented numbers, not from a study): 120 of 200 samples meet a criterion, and you test H0: p = 0.5.
- p̂ =
=120/200= 0.6. - Standard error:
=SQRT(0.5*(1-0.5)/200)= 0.035355. - z:
=(0.6-0.5)/0.035355= 2.8284. - Two-tailed p-value:
=2*(1-NORM.S.DIST(2.8284,TRUE))= 0.00468.
At α = 0.05 the critical value is 1.96, so 2.8284 leads to rejecting H0. For two groups, see the two-proportion z test.
How to read the output
Z.TEST returns a single number, the upper-tail probability, and nothing else: no z statistic, no confidence interval, no decision. Read it in this order:
- Decide the tail before looking. For a two-sided hypothesis, convert with the two-tailed formula; for H1 that the population mean is greater than x, the p-value is the Z.TEST value itself; for H1 that it is less than x, the p-value is 1 minus the Z.TEST value.
- Compare the p-value with α. A p-value below α is evidence against H0; it is not the probability that H0 is true.
- Report the z statistic, the sample mean and n alongside the p-value, calculated in helper cells as shown above.
With the Analysis ToolPak, the z-Test: Two Sample for Means tool performs a two-sample z test for means with known variances. Microsoft notes that its “P(Z ≤ z) one-tail” row is the probability of a z value at least as far from 0 in the observed direction, and the “P(Z ≤ z) two-tail” row is the one-tailed value multiplied by 2. When variances are unknown, Microsoft points to the Z.TEST worksheet function instead. For the full two-sample method, see the two-sample z test guide.
Troubleshooting Z.TEST
- #N/A. Microsoft documents that an empty array returns #N/A. Check that the range holds numbers.
- Result above 0.5. Not an error: the sample mean is below x. Use the two-tailed formula.
- #NUM! from NORM.S.INV. The probability was 0 or less, or 1 or more, for example from
=NORM.S.INV(1). - #VALUE! from NORM.S.INV or NORM.S.DIST. The argument is text, often a number stored as text or a percentage typed as a string.
- Result differs from another package. Check whether the other tool used the population sigma, the sample standard deviation, or a t distribution, and whether it reports one or two tails.
- Analysis ToolPak missing. Load it with the steps above.
Free alternatives to Excel for a z test
Two free tools can run the same test outside Excel.
| Tool | How it runs a z test | Where to read more |
|---|---|---|
| Python (statsmodels) | statsmodels.stats.weightstats.ztest(x1, x2=None, value=0, alternative='two-sided'): with x2 omitted it runs a one-sample test of the mean of x1 against value; alternative accepts ‘two-sided’, ‘larger’ or ‘smaller’; returns the test statistic and p-value |
statsmodels documentation (linked under Sources) |
| R | z test examples in R with worked output | Z test in R |
Unlike Z.TEST, statsmodels lets you choose the alternative directly and returns the z statistic as well as the p-value.
What about the F test statistic in Excel?
Excel’s F.TEST does not return the F statistic. Microsoft documents F.TEST(array1,array2) as returning the two-tailed probability that the variances of the two arrays are not significantly different, and it returns #DIV/0! if either array has fewer than two data points or a variance of zero. To get the F statistic itself, divide the two sample variances, for example =VAR.S(A2:A11)/VAR.S(B2:B11). The role of the F test relative to the t test is covered in F test vs t test.
The data table below summarises the Excel functions used in this guide, with their documented syntax and behaviour.
Frequently asked questions
How do I find the critical z in Excel?
Use =NORM.S.INV(1-α) for a one-tailed test or =NORM.S.INV(1-α/2) for a two-tailed test. At α = 0.05 these return 1.6449 and 1.9600.
How do I do a proportion z test in Excel?
Compute z = (p̂ − p0) / SQRT(p0 × (1 − p0) / n) in cells, then get the p-value with =2*(1-NORM.S.DIST(ABS(z),TRUE)). Excel has no single function for it. The worked example above gives z = 2.8284 and p = 0.00468.
What is the formula for a to z in Excel?
To turn a significance level α into a critical z, use NORM.S.INV(1-α) or NORM.S.INV(1-α/2). To turn a z into a p-value, use NORM.S.DIST with TRUE.
How do I find the F test statistic in Excel?
F.TEST returns a probability, not the statistic. Divide the larger sample variance by the smaller, for example with VAR.S, to get the F ratio.
Does Z.TEST give a one-tailed or two-tailed result?
One-tailed (the upper tail). Use =2 * MIN(Z.TEST(array,x,sigma), 1 - Z.TEST(array,x,sigma)) for a two-tailed p-value.
What happens if I leave out sigma?
Excel uses the sample standard deviation, which Microsoft’s formula writes as STDEV(array). The result is then an approximation, and a t test may be more appropriate for small samples.
Sources
- Microsoft Support: Z.TEST function, checked 2026-11-24
- Microsoft Support: NORM.S.INV function, checked 2026-11-24
- Microsoft Support: NORM.S.DIST function, checked 2026-11-24
- Microsoft Support: F.TEST function, checked 2026-11-24
- Microsoft Support: Use the Analysis ToolPak to perform complex data analysis, checked 2026-11-24
- statsmodels: statsmodels.stats.weightstats.ztest, checked 2026-11-24
Data: Excel functions used for a z test: syntax and documented behaviour
Compares the Excel worksheet functions used to run a z test (Z.TEST, NORM.S.DIST, NORM.S.INV, F.TEST), with their syntax, what each returns and the error or example documented by Microsoft Support. Compiled from the vendor's current function reference pages, read 2026-11-24.
| Function | Syntax | What it returns | Documented example or error |
|---|---|---|---|
| Z.TEST | Z.TEST(array,x,[sigma]) | One-tailed (upper) probability-value of a z test | With A2:A11 = 3,6,7,8,6,5,4,2,1,9: =Z.TEST(A2:A11,4) returns 0.090574; empty array returns #N/A |
| NORM.S.DIST | NORM.S.DIST(z,cumulative) | Standard normal cumulative distribution (TRUE) or probability mass function (FALSE) | =NORM.S.DIST(1.333333,TRUE) returns 0.908788726; non-numeric z returns #VALUE! |
| NORM.S.INV | NORM.S.INV(probability) | The z value whose standard normal cumulative probability equals the argument | =NORM.S.INV(0.908789) returns 1.3333347; probability = 1 returns #NUM! |
| F.TEST | F.TEST(array1,array2) | Two-tailed probability that the variances of two arrays are not significantly different (not the F statistic) | =F.TEST(A2:A6,B2:B6) returns 0.64831785 on Microsoft's sample data; fewer than 2 data points or zero variance returns #DIV/0! |
Sources
- Microsoft Support: Z.TEST function (accessed 2026-11-24)
- Microsoft Support: NORM.S.DIST function (accessed 2026-11-24)
- Microsoft Support: NORM.S.INV function (accessed 2026-11-24)
- Microsoft Support: F.TEST function (accessed 2026-11-24)
Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.







