Forum Discussion

ArchiveUser's avatar
ArchiveUser
Qrew Captain
7 years ago

How do I get my date formula to stop at zero?

So here is my current formula: WeekdaySub (ToDate(), Today())

Once we're past the Training Start Date it calculates negative values, however I would like to stop it at 0 since there has been a request to add a notification.

I've played around with the formula (adding a ,0) but just cannot seem to get it to work.

Thanks in advance for the help!
  • Ron, you just need an if formula to set it to zero when it goes negative.  See the following as an example.

    var number daysTillTraining =  WeekdaySub(ToDate(), Today()); If ( $daysTillTraining < 0 ,0 ,$daysTillTraining )
  • Alternatively

    Max(0, WeekdaySub (ToDate(), Today()))

    If the calculated value is less than zero then the 0 will be the "Max"

    same result as what Forrest posted.
  • Apologies for the delay in responding - finally got around to applying the formula this morning and it works beautifully.  

    Can't thank you enough for the help as I go through and try to fine-tune the app, based on user responses/feedback.  You folks make me look like a hero to them and for that, I can't thank you enough.