In cell A1 is the number 10

In cell A2 is the number 8

In cell B1 is the letter N

In cell B2 is the letter N

So, here's what I would like cell C1 to return based on the following...

If B1 and B2 = N, then the lowest number in either A1 or A2 must be subtracted from the highest number in either A1 or A2.

If B1 and B2 = S, then the lowest number in either A1 or A2 must be subtracted from the highest number in either A1 or A2.

If B1 and B2 have a different letter, that is, one has an N and the other an S, then A1 is to be added to A2.

.Thanks.