Forum Discussion
try this
Min(ToDays([Weekending Date]-[Employee - Departure / Check out]),7)
The bold part calculates the Duration, and then the ToDays function converts that span of time into a numeric number of days. So you will need to change the field type now to formula numeric.
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------
That worked great. One more question. In the situation where the Employee Departure date is past the weekending date, because we have already planned the departure for the next week the formula returns a negative number. Is there a way to add if - then 7?
Thanks,
Tara
------------------------------
Tara Stroup
------------------------------
- MarkShnier__You5 years ago
Qrew Legend
Assuming that your stated logic is what you actually want, I like to use what are called formula variables. That just makes the formula easier to read and to debug. Keep in mind it may very well be you who has to look back at this formula a year from now and ask "what was I doing here?".
var number RawDays = Min(ToDays([Weekending Date]-[Employee - Departure / Check out]),7);
IF($RawDays < 0, 7, $RawDays)
Here is a link to help on Formula variables.
https://help.quickbase.com/user-assistance/formula_variables.html
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------- TaraStroup5 years agoQrew Member
That worked great. Thank you Mark!
------------------------------
Tara Stroup
------------------------------