Forum Discussion

CREATECommercial's avatar
CREATECommercial
Copper Contributor
Apr 28, 2023
Solved

If than Formula.

If I want to run a formula that is IF cell E1 is less than 0, than 0, if greater than, then e1/d1 what would it look like. Thanks for any help as I am not great with IF than formulas.

  • mtarler's avatar
    mtarler
    Silver Contributor
    =IF(E1<0,0,E1/D1) that said if D1 is always positive then =MAX(0, E1/D1) would also work
    • CREATECommercial's avatar
      CREATECommercial
      Copper Contributor
      Thank you. This works great with one exception. When E1 is zero I get a #DIV/0! In the F1 cell the formula is in. It works great if the value of E1 is higher than zero.
      • HansVogelaar's avatar
        HansVogelaar
        MVP

        CREATECommercial 

        The formula would return #DIV/0! if D1 equals 0, not if E1 equals 0.

        Perhaps

         

        =IF(OR(E1<0,D1=0),0,E1/D1)

Resources