Netdays formula only on rows with a column value

Hello! I'm looking for some help with the Netdays formula. I am trying to create a helper column that tracks the number of days between a date column titled "Start Date" (when a project began) and a date column titled "Completion" (when a project is completed). My current formula, which is just a start, is this:

=NETDAYS([Start Date]@row, Completion@row)

While it yields a correct value for rows with both dates present, it generates following error for those rows without completion date:

#INVALID DATE TYPE

I believe this error is impacting my sheet summary where I am trying to track the average days it is taking my team to complete tasks. Is there a way to run the Netdays formula on the entire column, but only if there is a date value in the "Completion" column?

TIA for your help!

Best Answer

  • KPH
    KPH ✭✭✭✭✭✭
    Answer ✓

    You can use an IF function with ISBLANK.

    This formula:

    =IF(ISBLANK(Completion@row), "", NETDAYS([Start Date]@row, Completion@row))

    Says IF Completion@row is blank, return "" (nothing).

    If it is not then return the NETDAYS results.

Answers

  • KPH
    KPH ✭✭✭✭✭✭
    Answer ✓

    You can use an IF function with ISBLANK.

    This formula:

    =IF(ISBLANK(Completion@row), "", NETDAYS([Start Date]@row, Completion@row))

    Says IF Completion@row is blank, return "" (nothing).

    If it is not then return the NETDAYS results.

  • Anjanesh Vaidya
    Anjanesh Vaidya ✭✭✭✭✭

    Hi Alexandra Reeder,

    You can try the below formula with IFERROR, So, it will not generate an error.

    =IFERROR(NETDAYS([Start Date]@row, Completion@row), " ")

    Thank you

    Anjanesh Vaidya

    Thanks,

    Anjanesh Vaidya

    Smartsheet Development, Ignatiuz Software

    Did this answer help you? Show some love by marking this answer as "Insightful💡" or "Awesome❤️" and "Vote Up⬆️

  • Alexandra Reeder
    edited 02/23/24

    @KPH, your formula worked

    Thank you, both, for your willingness to help.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!