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

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • Answered
So here is my current formula: WeekdaySub (ToDate([Training Start Date]), 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!
Photo of Ron

Ron

  • 300 Points 250 badge 2x thumb

Posted 4 months ago

  • 0
  • 1
Photo of Forrest Parker

Forrest Parker

  • 598 Points 500 badge 2x thumb
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([Training Start Date]), Today());
If
(
$daysTillTraining < 0
,0
,$daysTillTraining
)
(Edited)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,346 Points 50k badge 2x thumb
Alternatively

Max(0, WeekdaySub (ToDate([Training Start Date]), Today()))

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

same result as what Forrest posted.
Photo of Ron

Ron

  • 300 Points 250 badge 2x thumb
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.