For Network Days formula how do I ignore blank date rows
Using this formula to calculate duration of a project
=NETWORKDAY([PoC start date]@row, [PoC End date]@row)
But for blank rows - "Invalid Data Type" is entered
Hence when I try to average the duration - I am receiving "Invalid Data Type" error.
How can I edit the above Network days formula to ignore blank cells ?
Best Answers
-
Try an IFERROR like so:
=IFERROR(NETWORKDAY([PoC start date]@row, [PoC End date]@row), "")
-
@keesuri25 You can suppress error messages by wrapping your formula in IFERROR:
=IFERROR(NETWORKDAY([PoC start date]@row, [PoC End date]@row), "")
This replaces any error messages with "", aka a blank cell.
Sometimes you might want a formula to not even act at all on any blank date fields, to avoid error messages altogether. In that case, you can use something like this that uses ISDATE to verify the values are dates before running the NETWORKDAY function:
=IF(AND(ISDATE([PoC start date]@row), ISDATE([PoC End date]@row)), (NETWORKDAY([PoC start date]@row, [PoC End date]@row)), "")
In English: If both fields are date values, run this NETWORKDAY formula, otherwise, leave this cell blank.
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
Answers
-
Try an IFERROR like so:
=IFERROR(NETWORKDAY([PoC start date]@row, [PoC End date]@row), "")
-
@keesuri25 You can suppress error messages by wrapping your formula in IFERROR:
=IFERROR(NETWORKDAY([PoC start date]@row, [PoC End date]@row), "")
This replaces any error messages with "", aka a blank cell.
Sometimes you might want a formula to not even act at all on any blank date fields, to avoid error messages altogether. In that case, you can use something like this that uses ISDATE to verify the values are dates before running the NETWORKDAY function:
=IF(AND(ISDATE([PoC start date]@row), ISDATE([PoC End date]@row)), (NETWORKDAY([PoC start date]@row, [PoC End date]@row)), "")
In English: If both fields are date values, run this NETWORKDAY formula, otherwise, leave this cell blank.
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
-
Thank you both for the prompt responses. Works like a charm :D
-
@Paul Newcome You gotta love the symmetry of the presentation here! 😂
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 67.1K Get Help
- 448 Global Discussions
- 154 Industry Talk
- 503 Announcements
- 5.4K Ideas & Feature Requests
- 85 Brandfolder
- 156 Just for fun
- 80 Community Job Board
- 512 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 308 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!