Forum Discussion

ItzJyprex's avatar
ItzJyprex
Copper Contributor
Nov 13, 2019

Excel formula

Hi i am making project for school and i have to make a formula. The formula is that if something is lower than 0 like -3 or something it automatically replaces it with 0. Does somebody know how i do this?

3 Replies

  • Patrick2788's avatar
    Patrick2788
    Silver Contributor

    ItzJyprex 

    It's do-able with custom cell formatting code.  However, this will change the display to 0 but not change the inherent value in the cell.

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    ItzJyprex 

    That's only if with macros. With formula you can't take value from the cell and put on this place another value.

    If you numbers are added manually you may apply data validation which won't allow to enter negative numbers.

    • mathetes's avatar
      mathetes
      Gold Contributor

      SergeiBaklanand @ItzJyprex 

       

      IF what you're looking for has to do with averaging grades or something like that...if the formula, in other words, is taking the results of some other cells, then it could read something like

      =MAX(0,AVERAGE(A1:A10)) which would give you a result of 0 if the average in fact was less than 0, but otherwise return the actual average. And you could replace the AVERAGE in that formula with SUM or whatever the other function is.

      Just recall I began this message with the word "IF"

      You could help both Sergei and me, @ItzJyprex , if you were to be more clear on what the formula that you're looking for is supposed to do.