I'm trying to compare the magnitudes of stars, and for that, I need the difference between them, but right now I can't figure out how to factor in whether the first magnitude is negative and the second positive, or vice-versa, or both negative... I should mention I really don't know a lot about coding, or maths for that matter.
It seems, you just want difference between maximum and minimum. Try-
=MAX(A2:B2)-MIN(A2:B2)
Use the following formula to spill results dynamically.
=BYROW(A2:B,LAMBDA(x,MAX(x)-MIN(x)))