Compatibility function

ZTEST function

Returns the one-tailed p-value of a z-test: the chance of a sample mean this high if the population mean were x. Replaced by Z.TEST.

Available in All versions of Excel, including Microsoft 365 and Excel for the web (kept for compatibility)

In every Excel versionWorks in Google Sheets

Older function. ZTEST still works, but for new workbooks use Z.TEST.

Syntax

ZTEST(array, x, [sigma])
ArgumentWhat it means
arrayRequiredThe sample data.
xRequiredThe population mean you are testing against.
sigmaOptionalThe known population standard deviation. If omitted, the sample standard deviation is used.

Returns: A one-tailed (upper tail) probability.

How ZTEST works

ZTEST checks whether a sample's average is higher than a claimed population average. It computes z = (sample mean − x) / (σ / √n) and returns 1 - NORMSDIST(z), the probability of seeing a sample mean at least this large if the true mean were x. A small result suggests the population mean is really above x.

It is one-tailed towards the high side. If the sample mean is below x you get a value above 0.5. For a two-sided test use 2 * MIN(ZTEST(array, x, sigma), 1 - ZTEST(array, x, sigma)). If you leave out sigma Excel uses the sample standard deviation, which strictly makes it a t-test situation — for small samples TTEST is more appropriate.

Compatibility note: ZTEST is one of the older statistical functions that Excel 2010 moved to the Compatibility group. It still works in every version, but for new workbooks Microsoft recommends Z.TEST. Identical arguments; rename to Z.TEST(array, x, [sigma]).

Examples

1One-tailed p-value

C2fx=ZTEST(A2:A11, 4)
ABC
1Data
230.090574
36
47
58
66
75
84
92
101
119

Result: 0.090574

The sample mean is 5.1. Using the sample standard deviation, the chance of a mean that high if the true mean were 4 is 0.090574 (formatted to 6 decimals) — not quite significant at 5%.

2Are bags overfilled?

C2fx=ZTEST(A2:A9, 500, 3)
ABC
1Fill (g)
25030.0226
3501
4499
5504
6502
7500
8505
9503

Result: 0.0226

The machine's known standard deviation is 3 g. The sample mean of 502.125 g gives a one-tailed p-value of 0.0226 (formatted to 4 decimals). That is below 0.05, so at the 5% level the machine is filling above the 500 g target.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 14 KB

Common errors and how to fix them

ErrorWhy it happensFix
#N/AThe array is empty.Check the data range.
#DIV/0!sigma is omitted and the sample has only one value (or no variation).Provide sigma or more data.

Tips

  • ZTEST is one-tailed (upper). It is not the two-tailed p-value many textbooks report.

Questions

Should I still use ZTEST?

Only if the workbook must open in Excel 2007 or earlier. Otherwise use Z.TEST, which gives the same result and makes the intent clearer to the next person who reads the formula.

Will ZTEST stop working?

There is no announced removal date. Microsoft keeps compatibility functions so old workbooks keep calculating, but they get no new features.

Google Sheets

ZTEST also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

ZTEST in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
DutchZ.TOETS
FinnishZTESTI
FrenchTEST.Z
GermanGTEST
HungarianZ.PRÓBA
ItalianTEST.Z
PolishTEST.Z
Portuguese (Brazil)TESTEZ
Portuguese (Portugal)TESTEZ
RussianZТЕСТ
SpanishPRUEBA.Z