When analyzing data sets, you may come across a situation where you need to test the hypothesis that two different samples come from populations with the same median. In statistics, this is known as a one-tailed test. If the null hypothesis is proven to be false, we can reject it and conclude that there’s a significant difference between the population medians. There are multiple ways of testing these hypotheses in Excel, but among them, T-test is one of the most common and straightforward ones. Read on to find out how to do T-test in Excel and when it should be used over other statistical tests.

**What is T-Test?**

T-test is one of the most common tests in statistics. It’s used to find out whether two sets of data come from populations that have the same median. If the null hypothesis is proven to be false, we can reject it and conclude that there’s a significant difference between the population medians. When testing the hypothesis, we assume that the two samples come from the same population with different medians. We then check whether the difference between the sample sizes is significant enough to conclude that the samples actually come from two different populations. Let’s say the difference between the sample sizes is greater than what we would expect to see if the samples came from the same population. This might suggest that the samples come from two different populations.

**When to use a T-test in Excel**

T-test is used to test the hypothesis that two samples come from populations with the same median, but with different sample sizes. When comparing two different sample sizes, the test becomes a one-tailed test. As a rule of thumb, you should perform a one-tailed test when you know the sample sizes are unequal and you’re trying to prove that the sample with a lower median is significantly different from the sample with a higher median. One-tailed tests are also used to detect outliers in the data, if any.

With a two-tailed test, you’re testing if the difference between the sample medians is significant enough to conclude that the two samples come from two different populations. With a two-tailed test, it doesn’t matter if the sample with a lower median is bigger or smaller than the sample with a higher median since you’re testing for significance regardless of which sample is bigger or smaller.

**How to do a T-test in Excel**

The formula for a T-test in Excel is =T.EST(data, control, alternative). If you’re testing the hypothesis that two samples come from populations with different medians, use alternative =two-sided. If you’re testing the hypothesis that the sample with the lower median is significantly different from the sample with the higher median, use alternative =less. If you want to test the hypothesis that the sample with the higher median is significantly different from the sample with the lower median, use alternative =greater.

To perform the test, you must first enter the two sample data sets in separate columns. The sample with the lower median must go in the first column, and the sample with the higher median must go in the second column. The next step is to enter the control for the test in the control column. Make sure you enter the sample size of the first sample and the sample size of the second sample in their respective columns, since the test uses these values to calculate the test statistic. The last step is to select the data and click on Data > Data Tools > T Test or use the keyboard shortcut Ctrl + T.

**Limitations of using T-test in Excel**

T-test is a good test for finding out whether two samples come from populations with different medians, but it doesn’t account for the significance of the difference between the sample medians. For example, the test doesn’t say whether the difference is significant enough to conclude that the two samples come from two different populations. It only tells you if the difference between the sample medians is significant or not. T-test is also known to produce false positive results, which means that it reports that the samples come from two different populations when they actually come from the same population. That’s why it’s important to use the test with caution and not make conclusions based solely on the outcome of the test.

**p-value for one-tailed test and T-test together**

When performing a one-tailed test with T-test, you have to find the p-value for the test. A p-value is the probability of getting a sample with a greater or lesser difference between the sample medians than the one you’ve observed if the null hypothesis is true. A low p-value indicates that the sample medians don’t come from populations with the same median. In this case, it means that the difference between the sample medians is significant enough to conclude that the two samples come from two different populations. If you get a high p-value, you should reject the null hypothesis and conclude that there’s no significant difference between the populations.

**Two-tailed test with t-test and p-value together**

When performing a two-tailed test, you also have to find the p-value for the test. The only difference is that you want to know if the difference between the sample medians is significant enough to conclude that the two samples come from two different populations. A low p-value indicates that the sample medians don’t come from populations with the same median. In this case, it means that the difference between the sample medians is significant enough to conclude that the two samples come from two different populations. If you get a high p-value, you should reject the null hypothesis and conclude that there’s no significant difference between the populations.

**Conclusion**

T-test is a useful test for deciding whether two samples come from populations with different medians. However, it doesn’t tell you whether the difference between the sample medians is significant enough to conclude that the samples actually come from two different populations. To do that, you also need to find the p-value for the test and compare it to the significance level.

**Related Course: Financial Modeling Skills Course**