How to set "0" if the cell value is negative?

valphi63 Posted messages 8 Status Member -  
valphi63 Posted messages 8 Status Member -
You can use the MAX function in your formula to ensure that the cell displays "0" instead of a negative number. For example, if your current formula is `=A1-B1`, you can modify it to `=MAX(0, A1-B1)`. This will return "0" if the result of `A1-B1` is negative.

3 answers

  1. Vaucluse Posted messages 27336 Registration date   Status Contributor Last intervention   6 453
     
    Hello

    =IF(formula=0,0,formula)

    or shorter:

    =MAX(formula,0)

    Thanks

    --
    The quality of the answer largely depends on the clarity of the question, thank you!
    11
    1. valphi63 Posted messages 8 Status Member
       
      Hello Vaucluse. So your answer did not solve my problem because I was probably not precise enough in my question.
      Here’s what I did:
      In cell D21, I put the formula =B19-C19 and according to this formula I have a positive result. Now, I’m trying to create a formula in cell C21 that goes as follows: =C19-B19 and I necessarily get a negative value. However, I would like in my formula whose value is negative to somehow make the value visible in cell C21 as "0".
      Thank you for your valuable advice and have a nice day.
      0
      1. yclik Posted messages 3875 Registration date   Status Member Last intervention   1 610 > valphi63 Posted messages 8 Status Member
         
        Good evening
        in C21
        =IF(C19-B19<0,0,"")
        6