Formula to show whichever is less
Hello,
I'm working on a formula to show the remaining duration of a task. I'd like to calculate workdays using the planned end date minus either today or the planned start date, whichever is closer to the planned end date. For example, if the planned start date is 10/29/21 and the planned end date is 11/05/21, then the formula would calculate the remaining workdays between today and 11/05/21. However, if the planned start date is 11/05/21 and the planned end date is 11/12/21, then the formula would calculate the number of workdays between 11/05 and 11/12. I'm stumped on how to write this formula. Any ideas?
Thanks!
Best Answer
-
You can use an IF statement for that.
If today is greater than the planned end, output zero, otherwise run the NETWORKDAYS calculation.
=IF(TODAY() >= [Planned End Date]@row, 0, NETWORKDAYS(MAX(TODAY(), [Planned Start Date]@row), [Planned End Date]@row))
Answers
-
So you essentially want to use the date that is greater (today or planned start)?
=NETWORKDAYS(MAX(TODAY(), [Planned Start Date]@row), [Planned End Date]@row)
-
@Paul Newcome Thank you! That worked perfectly. I have a follow up question. Do you know what I can add to the formula so that tasks in which the planned end has already passed show as 0 instead of a negative number?
-
You can use an IF statement for that.
If today is greater than the planned end, output zero, otherwise run the NETWORKDAYS calculation.
=IF(TODAY() >= [Planned End Date]@row, 0, NETWORKDAYS(MAX(TODAY(), [Planned Start Date]@row), [Planned End Date]@row))
-
@Paul Newcome Thank you so much! I really appreciate the help.
-
Happy to help. 👍️
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!