how do I write a formula if b2 is less than a2 then subtract

  • Thread starter delete automatically
  • Start date
D

delete automatically

I'm looking for a formula that says if b2 is less than a2 then subtract but
if greater than then add
Thanks
 
J

JMB

Try:

=IF(B2<A2,A2-B2,A2+B2)

although you didn't specify what to do when A2=B2. this formula would add
A2 and B2 when they are equal.
 
T

Trevor Shuttleworth

Not sure I understand but ...

=IF(A2>B2,A2-B2,A2+B2)

Regards

Trevor
 
T

T. Valko

I'm looking for a formula that says if b2 is less than a2 then subtract

Ok, subtract what? B2 from A2?

Also, you didn't say what to do if A2 = B2.

=IF(B2<A2,A2-B2,A2+B2)

If A2 = B2 they will be added.
 
Top