Hypothesis Test for Two Means

  • When to use it: To test the difference of two sample means when population variances are unknown but considered equal

For more informations about Hypothesis Test for Two Means click here.



Let's compare certain engine head dimensions from two different production lines. A sample of 10 items was taken from line 1 and a sample of 12 items was taken from line 2.

We will use Excel to perform a hypothesis test of equality of means of the two lines using \( \alpha = 0.05 \) and assuming the samples come from normal distributions with unknown but equal variances.

The null hypothesis: The means are equal using \( \alpha = 0.05 \)
H0: \( \mu_1 = \mu_2 \)      Ha: \( \mu_1 \neq \mu_2 \)
We calculate t as: \( t = \displaystyle \frac{\bar{X}_1 - \bar{X}_2}{\displaystyle s_p \sqrt{ \frac{1}{n_1} + \frac{1}{n_2}}} \)




Using Excel:

First one needs to check if the DATA ANALYSIS menu is activated: Under DATA select DATA ANALYSIS. If it’s empty, then select EXCEL OPTIONS, ADD-INS, GO and select ANALYSIS TOOLPAK and ANALYSIS TOOLPAK- VBA and hit ok. The toolpaks may need to be installed. Go again to the DATA ANALYSIS menu and you should see the following image:

In the Data Analysis toolbox, scroll down and select t-Test: Two-Sample Assuming Equal Variances. Input appropriate column ranges for the data, the hypothesized mean difference, and an alpha value (default = 0.05).

Excel should calculate the following:

We can see that the null hypothesis is not rejected for a two-sided t-test. (p-value = 0.568 > 0.05 = \( \alpha \))


Running a two sample Z test:


Do it yourself

Step 1: Go to "Attachments" on the bottom of this page and dowload the Excel spreadsheet.

Step 2: Follow the steps teached in the video above and solve the exercises in the Excel spredsheet dowloaded. 

Step 3: Answer the questions in the Interactive Content below.