Is there a way to calculate Netdays using 2 sets of dates
I have 4 columns with dates (they are set as date columns). Here is what I want to do using the following example:
- These are the 4 columns with their values:
- Check-In Date: 01/27/2024
- Check-Out Date: 02/10/2024
- Start Date: 01/01/2024
- End Date: 02/04/2024
- The Netdays between the Check-In Date and Check-Out Date = 15
- But the Netdays of the Check-In Date and Check-Out Date that fall between the Start Date and End Date = 9
Is there a way to calculate the Netdays within a date range this using a formula?
Thanks in advance.
Best Answer
-
That would look something more like this:
=IF(AND([Check-In Date]@row <> "", [Check-Out Date]@row <> ""), MAX(0, MIN([Check-Out Date]@row, [End Date]@row) - MAX([Check-In Date]@row, [Start Date]@row)))
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
Answers
-
You would use a MAX function to grab the latest between start and check-in and then a MIN to grab the earliest between the end and check-out. Then you would subtract the max from the min.
=MIN([Check-Out Date]@row, [End Date]@row) - MAX([Check-In Date]@row, [Start Date]@row)
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
-
Thank you for the quick response, Paul. The formula definitely works. However, it is also pulling negative numbers and showing numbers when dates are blank. Here is an example:
With this formula, is there a way to have these shown as blanks or a 0?
-
That would look something more like this:
=IF(AND([Check-In Date]@row <> "", [Check-Out Date]@row <> ""), MAX(0, MIN([Check-Out Date]@row, [End Date]@row) - MAX([Check-In Date]@row, [Start Date]@row)))
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
-
@Paul Newcome Thank you, this worked perfectly!
-
Happy to help. 👍️
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.9K Get Help
- 378 Global Discussions
- 208 Industry Talk
- 441 Announcements
- 4.5K Ideas & Feature Requests
- 139 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 449 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 290 Events
- 33 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!