Netdays calculation with optionnal date column
Hi
i'm looking for a formula to calculate the netdays between 2 dates. but i have 3 dates in the equation. a date column (date 1) whit references from another sheet and a manual one (date 2) to overwrite the first one. the third date is the "today" date (date 3).
so i'm looking for something like: netdays between date 1 and date 3 if there is NO date 2, if there is a date 2 then calculate the netdays between date 2 and date 3.
thank you for your help
Best Answer
-
@Julien Lopez if there is date on both Date 1 and Date 2, it will return a blank/ empty cell.
If this is the case, you'd need to add another IF statement:
IF(AND([Hiring Date]@row <> "", [Corrected Hiring Date]@row <> ""), NETDAYS([Corrected Hiring Date]@row, [Start Date Rotation]1))
Final formula:
=IF(AND([Hiring Date]@row <> "", [Corrected Hiring Date]@row = ""), NETDAYS([Hiring Date]@row, [Start Date Rotation]1), IF(AND([Hiring Date]@row = "", [Corrected Hiring Date]@row <> ""), NETDAYS([Corrected Hiring Date]@row, [Start Date Rotation]1), IF(AND([Hiring Date]@row <> "", [Corrected Hiring Date]@row <> ""), NETDAYS([Corrected Hiring Date]@row, [Start Date Rotation]1))))
Melissa Yamada
melissa@insightfulsheets.com
Data made simple, spreadsheets reimagined
Answers
-
Hello @Julien Lopez ,
I'd be happy to help!
You'll use a nested IF for this formula.
- netdays between date 1 and date 3 if there is NO date 2 (First IF statement: =IF(AND([Date 1]@row <> "", [Date 2]@row = ""), NETDAYS([Date 1]@row, [Date 3]@row)))
- if there is a date 2 then calculate the netdays between date 2 and date 3 (Second IF statement: IF(AND([Date 1]@row = "", [Date 2]@row <> ""), NETDAYS([Date 2]@row, [Date 3]@row)))
Then combining the 2 IF statements will give you the final formula:
=IF(AND([Date 1]@row <> "", [Date 2]@row = ""), NETDAYS([Date 1]@row, [Date 3]@row), IF(AND([Date 1]@row = "", [Date 2]@row <> ""), NETDAYS([Date 2]@row, [Date 3]@row)))
You may refer to these articles:
Melissa Yamada
melissa@insightfulsheets.com
Data made simple, spreadsheets reimagined -
Hello @Melissa Yamada, thank you for your help
the formula works well for the first part (Date 1 and Date 3) but the cell is empty when the is a Date 2.
here is the formula i tried:
=IF(AND([Hiring date]@row <> "", [corrected hiring date]@row = ""), NETDAYS([Hiring date]@row, [Start date rotation]1), IF(AND([Hiring date]@row = "", [corrected hiring date]@row <> ""), NETDAYS([corrected hiring date]@row, [Start date rotation]1)))
Date 1: Hiring date
Date 2: corrected hiring date
Date 3: start date rotation
thank you
-
@Julien Lopez if there is date on both Date 1 and Date 2, it will return a blank/ empty cell.
If this is the case, you'd need to add another IF statement:
IF(AND([Hiring Date]@row <> "", [Corrected Hiring Date]@row <> ""), NETDAYS([Corrected Hiring Date]@row, [Start Date Rotation]1))
Final formula:
=IF(AND([Hiring Date]@row <> "", [Corrected Hiring Date]@row = ""), NETDAYS([Hiring Date]@row, [Start Date Rotation]1), IF(AND([Hiring Date]@row = "", [Corrected Hiring Date]@row <> ""), NETDAYS([Corrected Hiring Date]@row, [Start Date Rotation]1), IF(AND([Hiring Date]@row <> "", [Corrected Hiring Date]@row <> ""), NETDAYS([Corrected Hiring Date]@row, [Start Date Rotation]1))))
Melissa Yamada
melissa@insightfulsheets.com
Data made simple, spreadsheets reimagined -
thank you so much!!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.3K Get Help
- 423 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 143 Just for fun
- 59 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 300 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!