Formula Required

I require a formula for the following...
For example, assume
Cell A1 has the number 10
Cell A2 has the number 8
Cell B1 has the letter N
Cell B2 has the letter N

So, I need a formula for Cell A3 to return a result based on these following conditions.
If B1 and B2 = N then the lowest number in A1 or A2 must be subtracted from the highest number in A1 or A2.
It B1 and B2 = S then the lowest number in A1 or A2 must be subtracted from the highest number in A1 or A2.
If B1 and B2 have a different letter, that is, one has an N and the other an S, then add A1 and A2 together.
Look forward to getting a solution.
Thanks.

Here you go

=ABS(IF(B1=B2,A2-A1,A1+A2))

Hope this helps

Jon, many thanks for your

Jon, many thanks for your reply to my question.
It works great.
Thank you.

glad to have been of help :)

glad to have been of help :)