Forum Discussion

Beth Rodriguez's avatar
Beth Rodriguez
Copper Contributor
Aug 03, 2017

Excel conditional if statement

I am trying to create an if statement to calculate accrued hours every 125 hours.  THe statement that I have now is =IF(C2>$C$1,1,0) where $C$1 = 125 but I need this every 125 hours and only 1 every 125 hours not to 1 everytime over 125 adding many more. so if one line shows 130 then my if statement picks up 1 but on my next line it shows 140 I do not need it to pick up an additional 1 making it 2 that line needs to be 0. Can someone please help me with this formula.

  • Hi Beth,

    Not sure i understood correctly, perhaps you shall use

    =INT(C2/$C$1)

    instead

     

    • Beth Rodriguez's avatar
      Beth Rodriguez
      Copper Contributor

      with the formula I am using it is adding a 1 to every cell after I hit 125.  What I need is for it to add 1 each time i total 125.  so I get 1 at 125 I will get another one at 250 then another one at 375 and so on. With what I have it has given me 1 at 130 then another at the next cell which happens to be 140 given me a total of 2 and it should only be 1 at this point.  Sorry not real sure how to explain it well.

       

      • Detlef_Lewin's avatar
        Detlef_Lewin
        Silver Contributor

        Beth,

         

        another try:

        D2

        =QUOTIENT(C2,$C$1)

        E2

        =IF(COUNTIF(D$2:D2,D2)=1,D2,"")

Resources