Based on the relationship between the Mann-Whitney Test and the Wilcoxon Rank-Sum Test, we can modify the exact test described in Wilcoxon Rank-Sum Exact Test to provide an exact test for Mann-Whitney.

The one-tail Wilcoxon Rank-Sum exact test is as follows:

p-value = PERMDIST(*W*, *n*1, *n*2, TRUE)

T-crit = PERMINV(*α*, *n*1, *n*2)

This turns into the one-tail Mann-Whitney exact test is as follows:

p-value = PERM2DIST(COMBIN(MIN(*n*1, *n*2)+1,2)+*U*, *n*1, *n*2, TRUE)

U-crit = PERM2INV(*α*, *n*1, *n*2)-COMBIN(MIN(*n*1, *n*2)+1, 2)

The two-tail Wilcoxon Rank-Sum exact test is as follows:

p-value = 2 * PERMDIST(*W*, *n*1, *n*2, TRUE)

T-crit = PERMINV(*α*/2, *n*1, *n*2)

This turns into the two-tail Mann-Whitney exact test is as follows:

p-value = 2 * PERM2DIST(COMBIN(MIN(*n*1, *n*2)+1,2)+*U*, *n*1, *n*2, TRUE)

U-crit = PERM2INV(*α*/2, *n*1, *n*2)-COMBIN(MIN(*n*1, *n*2)+1, 2)

The p-values for the two-tailed test are correct as long as the p-value for the one-tailed test is at most .5.

**Real Statistics Functions**: The Real Statistics Resource Pack contains the following functions which implement the process described above.

**MANNDIST**(*x*, *n*1, *n*2, *tails*) = value of the Mann-Whitney distribution at *x* based on and elements, where *tails* = 1 (default) or 2; i.e. the p-value as defined above

**MANNINV**(*p*, *n*1, *n*2, *tails*) = inverse of the Mann-Whitney distribution at *p*; i.e. the least value of such that MANNDIST(*x*, *n*1, *n*2, *tails*) ≥ *p*, where *tails* = 1 (default) or 2; i.e. U-crit as defined above

**MANN_EXACT**(R1, R2, *tails*) = p-value of the Mann-Whitney exact test on the data in ranges R1 and R2, where *tails* = 1 or 2 (default)

Thus for the two-tailed test for Example 1 of Mann-Whitney Test, we have

MANNDIST(H11,H5,I5,2) = .117928

MANNINV(.05,H5,I5,2) = 34

MANN_EXACT(A6:A17,B6:B16,2) = .117928

**Observation**: These functions are quite computationally intensive. Depending on the power of your computer they compute quite quickly for values of *n = n*1 + *n*2 up to about 24 or 25, a little higher when *n*1 is much higher than *n*2. For larger values of *n* these functions are probably too slow to be of practical use for most situations.