Learning Z-Tests: A Step-by-Step Guide to One and Two Sample Z-Tests in Excel


The Essential Role of Z-Tests in Statistical Analysis

Statistical analysis relies heavily on hypothesis tests to make informed decisions about population parameters based on sample data. The Z-test is one of the most fundamental tools in this repertoire, particularly useful when the data follows a normal distribution and, critically, when the population standard deviation is already known. This condition allows for greater certainty in assessing sample differences.

Specifically, a one-sample Z-test serves to evaluate whether a sample mean significantly deviates from a known or hypothesized population mean. For instance, researchers often use this test to confirm if a new experimental group performs significantly differently from the established norm. The underlying assumption is that the large sample size or known standard deviation provides a reliable basis for comparison.

Conversely, the two-sample Z-test expands this comparison to assess whether the means of two distinct, independent populations are statistically different from one another. This test is indispensable in comparative studies, such as evaluating the performance metrics between two different manufacturing processes or assessing academic outcomes in two separate schools. Throughout this guide, we will demonstrate how Microsoft Excel, utilizing both built-in functions and specialized add-ins, enables efficient execution of both the one-sample and two-sample Z-tests.

Case Study 1: Performing the One Sample Z-Test via Z.TEST

To illustrate the application of a one-sample Z-test, consider the widely accepted standardized measure of cognitive function: the IQ score. In the general population, IQ is modeled as normally distributed with a mean (μ) of 100 and a known population standard deviation (σ) of 15. A pharmaceutical research team investigates whether a newly developed medication impacts cognitive performance.

The team conducts a study involving 20 volunteer patients who receive the medication for a defined period. At the conclusion of the treatment, the individual IQ scores are recorded. Our objective is to determine, using the one-sample Z-test, if the average IQ score of this sample group is statistically significantly different from the established population mean of 100. This requires setting up the appropriate formula in Excel.

Excel streamlines this process via the robust, native function, Z.TEST. To correctly implement this function, three core arguments must be provided: the range containing the sample data (the array), the hypothesized population mean (the benchmark), and the known population standard deviation. Assuming the 20 recorded IQ scores are placed in cells A2 through A21, the formula is structured precisely as follows:

=Z.TEST(A2:A21, 100, 15)

The visual representation below confirms the correct syntax and initial output provided by the Z.TEST function within the Excel environment.

One sample z-test in Excel

Interpreting and Converting the One Sample Test Output

It is essential to understand precisely what the Z.TEST function returns. The value generated by Excel is specifically the one-tailed p-value. In the example calculation above, this one-tailed p-value is returned as 0.181587. However, the research question—determining if the medication causes a “significant difference”—is inherently non-directional, meaning the average IQ could be either higher or lower than 100. This requires a two-tailed hypothesis test.

To convert the one-tailed result into the necessary two-tailed p-value, we must multiply the Excel output by 2. Executing this conversion yields a two-tailed p-value of 0.363174. This final calculated value serves as the basis for our statistical conclusion and must be compared against the predetermined significance level (α), which is almost universally set at 0.05.

The decision rule dictates that we only reject the null hypothesis (H₀: μ = 100) if the calculated p-value is less than α (0.05). Since 0.363174 is substantially greater than 0.05, we do not possess sufficient statistical evidence to reject H₀. Therefore, the conclusion drawn from this analysis is that the new medication, based on the sampled data, does not produce a statistically significant effect on the average cognitive function (IQ) of the patient group.

Case Study 2: Utilizing the Data Analysis ToolPak for Two Sample Z-Tests

When the statistical objective shifts to comparing the means of two independent groups, assuming known population standard deviations, the two-sample Z-test is the appropriate methodology. We will examine a scenario where a researcher wishes to compare the mean IQ levels between two distinct geographic populations, City A and City B. For this investigation, we maintain the assumption that IQ scores in both populations are normally distributed and share an identical, known standard deviation of 15.

The researcher proceeds by collecting random samples of 20 individuals from each city, recording their respective IQ scores. The central research question is whether a statistically significant difference exists in the mean IQ level between the residents of City A and City B. Unlike the one-sample test, the two-sample Z-test in Excel requires the use of the specialized Data Analysis ToolPak add-in.

The raw data collected for this comparative study is presented below, showing the sample scores for both groups side-by-side within the spreadsheet:

To initiate the two-sample analysis, users must first ensure the ToolPak is enabled. Navigate to the Data tab located on the Excel ribbon, and then locate and click the Data Analysis button, which is typically situated in the far right Analysis group. If this option is missing, the add-in must be enabled through Excel’s options menu. Once the tool is active, select the z-Test: Two Sample for Means option from the list that appears in the dialogue window, and confirm your choice by clicking OK.

Parameter Configuration and Drawing Final Conclusions

The subsequent parameter input window is crucial for obtaining accurate results. Users must carefully input the data ranges for Variable 1 (City A) and Variable 2 (City B). Furthermore, the hypothesized mean difference should be set to 0, representing the assumption of no difference between the two city means under the null hypothesis. Most importantly, the ToolPak requires the input of population variance, not the standard deviation.

Since the known population standard deviation (σ) is 15, the required variance (σ²) is calculated as 15 * 15 = 225. This value must be entered for both the Variable 1 and Variable 2 Variance fields. After specifying the desired output range for the results table, click OK to generate the comprehensive statistical output.

The detailed output table, generated automatically by the ToolPak, provides all necessary statistics for interpretation. Key values include the calculated test statistic (Z Stat), which is -1.71817, and the two-tailed p-value (P(Z <= z) two-tail), which is .085765. The full results are displayed in the specified output range, typically starting at cell E1.

To conclude the analysis, we compare the resulting two-tailed p-value (0.085765) against the standard significance level (α = 0.05). Since the p-value is greater than 0.05, we cannot reject the null hypothesis of equal means. Consequently, based on the collected samples, the data indicates that there is no statistically significant difference in the mean IQ level between the two cities under comparison.

Expanding Your Statistical Toolkit in Excel

Mastering the Z-test within Microsoft Excel provides a foundational competency for robust quantitative analysis. Whether utilizing the direct Z.TEST function or the comprehensive Data Analysis ToolPak, Excel remains an accessible and powerful platform for conducting essential statistical procedures. Readers interested in deepening their analytical skills are encouraged to explore tutorials covering other common inferential tests, such as t-tests and ANOVA, to build a comprehensive approach to data interpretation.

Cite this article

Mohammed looti (2025). Learning Z-Tests: A Step-by-Step Guide to One and Two Sample Z-Tests in Excel. PSYCHOLOGICAL STATISTICS. Retrieved from https://statistics.arabpsychology.com/perform-one-sample-two-sample-z-tests-in-excel/

Mohammed looti. "Learning Z-Tests: A Step-by-Step Guide to One and Two Sample Z-Tests in Excel." PSYCHOLOGICAL STATISTICS, 2 Nov. 2025, https://statistics.arabpsychology.com/perform-one-sample-two-sample-z-tests-in-excel/.

Mohammed looti. "Learning Z-Tests: A Step-by-Step Guide to One and Two Sample Z-Tests in Excel." PSYCHOLOGICAL STATISTICS, 2025. https://statistics.arabpsychology.com/perform-one-sample-two-sample-z-tests-in-excel/.

Mohammed looti (2025) 'Learning Z-Tests: A Step-by-Step Guide to One and Two Sample Z-Tests in Excel', PSYCHOLOGICAL STATISTICS. Available at: https://statistics.arabpsychology.com/perform-one-sample-two-sample-z-tests-in-excel/.

[1] Mohammed looti, "Learning Z-Tests: A Step-by-Step Guide to One and Two Sample Z-Tests in Excel," PSYCHOLOGICAL STATISTICS, vol. X, no. Y, ص Z-Z, November, 2025.

Mohammed looti. Learning Z-Tests: A Step-by-Step Guide to One and Two Sample Z-Tests in Excel. PSYCHOLOGICAL STATISTICS. 2025;vol(issue):pages.

Download Post (.PDF)
Scroll to Top