Invalid Data Type when Date column empty

Options
Kelly W
Kelly W ✭✭✭
edited 12/16/22 in Formulas and Functions

Hi all,

I'm using the formula below to calculate the NETWORKDAYS

between the date an invoice was submitted until it is paid, if it has not been paid it calculates the NETWORKDAYS with TODAY. The formula is working, however, I'm getting an error on every row that does not have a date sent for payment yet. Is there a way to add IFERROR to this?

=IF(ISBLANK([Invoice Paid]@row), NETWORKDAYS([Date Sent for Payment]@row, TODAY()), NETWORKDAYS([Date Sent for Payment]@row, [Invoice Paid]@row))

Answers

  • Jeff Reisman
    Jeff Reisman ✭✭✭✭✭✭
    Options

    @Kelly W

    The error comes from trying to run a calculation against a blank field. It's like trying to divide by zero 😁

    You can avoid this in two different ways:

    Method 1 - Limiting the formula to only run if there's a date value in the field,

    Method 2 - suppressing the error message.

    Method 1: Embed your IF inside an IF that checks for a date in the field

    =IF(ISDATE([Date Sent for Payment]@row), IF(ISBLANK([Invoice Paid]@row), NETWORKDAYS([Date Sent for Payment]@row, TODAY()), NETWORKDAYS([Date Sent for Payment]@row, [Invoice Paid]@row)), "")

    Method 2: Use IFERROR to suppress the error message.

    =IFERROR(IF(ISBLANK([Invoice Paid]@row), NETWORKDAYS([Date Sent for Payment]@row, TODAY()), NETWORKDAYS([Date Sent for Payment]@row, [Invoice Paid]@row)), "")

    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

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!