# Two sample t-test using XLSTAT spreadsheet functions

On top of user-friendly dialog boxes, XLSTAT offers the possibility to instantly launch a wide range of analyses using simple functions within an Excel spreadsheet. This allows you to benefit from XLSTAT algorithms while linking Excel cells and performing simple or complex Excel operations. Please consult our tutorial to see how to use all XLSTAT functions within an Excel sheet.

This tutorial below will show you how to launch two-sample t-tests using the XLSTAT software spreadsheet functions in Excel.

## How to do a 2 sample t-test in excel?

• Click on the Insert Function button to access our different functions.

• Select XLSTAT in the Or select a category field.

• Select the XLSTAT_TTest function to run a Student t test in order to compare two paired samples.

• Click on the cell where you want to insert the function and obtain its result. For example, select the A2 cell.

• Select the XLSTAT_TTest function and click OK. • Then select the two ranges where the data are. Be careful, do not select the sample label, or it will generate an error. Only the first two fields must be filled in. The other ones are optional.

• Enter TRUE in the Paired field as the data are paired. • The last option (you need to scroll down in the dialog box), which is PValOut, is true by default and makes that the result is the p-value. For information, if you set that option to false, you obtain the value of the Student t statistic.

• Click OK to display the result of the t-test calculation in Excel. The p-value is 0.36 which means that the null hypothesis that the samples have an identical mean cannot be rejected with a significance level of 0.05. ## Which are the arguments to configure for a 2-sample t-test in XLSTAT?

The arguments of the XLSTAT_TTest function are:

• V1: range for the first sample

• V2: range for the second sample

• Tail: 0 for a two-sided test, -1 for a lower one-sided test, 1 for an upper one-sided test

• HypDiff: the hypothesized difference between the two samples

• Paired: TRUE if the two samples are paired

• EqualVar: TRUE if the two variances are assumed to be equal

• pvalOut: TRUE (default) if you want to display the p-value, FALSE if you want to display the t statistic.

The Student t test requires that we assume that the variables from which the samples are obtained follow a normal distribution. If this appears does not appear to be likely, one can run a Wilcoxon signed rank test, which is a nonparametric test, meaning there is no need to assume a distribution for the data.

## Which are the arguments to configure a Wilcoxon signed rank test in XLSTAT?

The arguments of the XLSTAT_WilcoxonTest function are:

• V1: range for the first sample

• V2: range for the second sample

• Tail: 0 for a two-sided test, -1 for a lower one-sided test, 1 for an upper one-sided test

• Correction: TRUE if the correction should be applied with the approximation (default is TRUE)

• ExactTest TRUE if you want to run the exact test (default is TRUE)

• pvalOut: TRUE (default) if you want to display the p-value, FALSE if you want to display the V statistic. With the Wilcoxon signed rank test we obtain a p-value of 0.43 which leads to the same conclusion that we cannot reject the null hypothesis that the samples are identical for what concerns their location.

When the data are not paired, you can use a two independent sample t-test in excel with the same XLSTAT_TTest function as above if the data follow a normal distribution (Paired = FALSE), or a Mann-Whitney test if you want to use a non-parametric test. 