Forum Discussion

Matan_Avishai's avatar
Matan_Avishai
Copper Contributor
Oct 12, 2022
Solved

Add a difference between numbers with minus

Hi, 

 

I want to create a formula that gives the number 2 if two cells are equal, but if the numbers are different - I want to get the difference between them, but in negative form (For example: If A1 is 6 and B1 is 4, I want to get -2). I want to clarify that a simple sum formula probably isn't good in that case because in some cases A would be the bigger number, and in other cases B would be the bigger, and I want it to always be negative. 

 

I made the first step of the formula - =IF(A1=B1,2) - but don't know how to proceed from here. 

 

Thanks in advance! 

    • Matan_Avishai's avatar
      Matan_Avishai
      Copper Contributor
      Thank you!
      Is there a way to leave this cell blank as long as I don't fill the other two (right now it says 2 because the empty cells are equals..)?
      It's not critical, but I'd like to do it if possible.

      Thanks again!

Resources