Formula to include weekends & Holidays in count but exclude weekends as a date for the result
I'm converting a file from Excel to Smartsheets for Quarterly, Semi-Annual, & Annual inspections. I want to set the first inspection date up and then have formulas in place to auto assign the remaining inspection dates for the next 2-3 years. I'm using WORKDAYS with an if formula which is providing a result but it's not calculating the way I need it to. For example, if my first Annual inspection is 2/25/2022, then my next one should be 2/25/2023 but that date falls on a weekend so I would want to schedule the inspection the 1st day following the weekend. The function I'm using is setting the next inspection date for 7/11/2023 which is 511 days. How do I get the weekends and Holidays to calculate in my total days but not be set as a date for inspection?
Below are the formulas I'm using in Smartsheets as well as Excel. (I know Excel formulas don't work the same in Smartsheets)
Smartsheets: =IFERROR(IF($Package@row = "Quarterly", WORKDAY([Start Date]@row, 90), IF($Package@row = "Semi-Annually", WORKDAY([Start Date]@row, 180), IF($Package@row = "Annually", WORKDAY([Start Date]@row, 365)))), 0)
I have not added a Holiday reference to my formula yet but will be
Excel: =WORKDAY(J2+IF($H2="Semi-Annually",180,IF($H2="Annually",365,IF($H2="Quarterly",90)))-1,1,'DATA VALIDATION'!$E4:$E43)
**J2 is my start date - H2 is my package type - Data Validation houses my Holidays to exclude
Answers
-
Hi @TashaD
The way I would personally do this is to directly add one day less than what you need (ex. 89 days versus 90), then add one WORKDAY so that you can skip holidays and weekends if that final day is on a holiday or weekend.
Ex:
=IF($Package@rowΒ = "Quarterly", WORKDAY([Start Date]@row + 89, 1)
Adding the number before the comma means that it will add the number of days including holidays and weekends, and then the 1 after the comma is the workday added. If you have holidays to exclude as well, you can reference these at the end of your WORKDAY function:
=IF($Package@rowΒ = "Quarterly", WORKDAY([Start Date]@row + 89, 1, Holidays:Holidays)
Let me know if this makes sense and works for you!
Cheers,
Genevieve
Need more information? π | Help and Learning Center
γγγ«γ‘γ― (Konnichiwa), Hallo, Hola, Bonjour, OlΓ‘, Ciao!π | Global Discussions
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 67.8K Get Help
- 474 Global Discussions
- 205 Use Cases
- 517 Announcements
- 5.5K Ideas & Feature Requests
- 87 Brandfolder
- 157 Just for fun
- 83 Community Job Board
- 521 Show & Tell
- 36 Member Spotlight
- 3 SmartStories
- 309 Events
- 37 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!