How to use multiple if not or statements

Zach Henderson
Zach Henderson ✭✭✭
edited 03/12/22 in Formulas and Functions

I am receiving an "invalid data type" result when I run this:

=IF(NOT(ISBLANK([Start Date]@row)), NETWORKDAYS([Due Date]@row, IF([Date Completed]@row <> "", [Date Completed]@row, TODAY())))

and there is a null value for Due date.

How can I add OR statement to this so that if either Start Date OR Due date are (not) blank then it will continue the function?


Answers

  • James Keuning
    James Keuning ✭✭✭✭✭
    edited 03/12/22

    You are getting that because Smartsheet is writing a date to that field, which is not a Date field. There is a way you can write a "date" to that field if this really what you want to do, basically explode the date into date parts and then reconstruct them as a string.

    The answer to the question you ask is:

    =IF(OR(NOT(ISBLANK([Start Date]@row)), NOT(ISBLANK([Due Date]@row))) = true, "True", "False")

  • Thanks for your help!


    Right. I am not looking for a date to be written to the "days overdue" field. If either the start date or the due date are null, I just want to ignore the formula so that there's not an error in that cell.


    If there are both a start date and a due date, the formula should then provide me a "days overdue" value (either positive or negative value).

    So:

    IF(NOT(ISBLANK([Start Date]@row))

    AND

    IF(NOT(ISBLANK([Due Date]@row))

    Then

    NETWORKDAYS([Due Date]@row, IF([Date Completed]@row <> "", [Date Completed]@row, TODAY())))


    How do I put all of that together in a formula that will work?

  • Actually I got it! I should have been using AND instead of OR

    =IF(AND(NOT(ISBLANK([Start Date]@row)), NOT(ISBLANK([Due Date]@row))), NETWORKDAYS([Due Date]@row, IF([Date Completed]@row <> "", [Date Completed]@row, TODAY())))


    Works great. Thank you!


Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!