Need help with Nested If Statement

Ute
Ute ✭✭✭✭
edited 04/02/24 in Formulas and Functions

I need some help with a nested formula. I've spent hours on this and cannot seem to get it to work.

I'm basically looking for the following function: If date column 1 and date column 2 are not blank, then, If these dates (date column 1 and date column 2) are the same, enter 0, if not, return the number of days between the first and the second date, if not, enter "N/A".

Here is one function I've tried:

=IF(AND(NOT(ISBLANK([Initial Project Presentation on]@row, [Tollgate 1 approved on]@row), IF([Initial Project Presentation on]@row = [Tollgate 1 approved on]@row, 0, (NETDAYS([Initial Project Presentation on]@row, [Tollgate 1 approved on]@row))), "N/A")))

Any help would be appreciated.


Thank you!

Tags:

Best Answer

  • JamesB
    JamesB ✭✭✭✭✭✭
    Answer ✓

    @Ute

    In your AND argument you need to qualify both statements, and I needed to adjust some of the parentheses. Try this.

    =IF(AND(NOT(ISBLANK([Initial Project Presentation on]@row)),NOT(ISBLANK([Tollgate 1 approved on]@row))), IF([Initial Project Presentation on]@row = [Tollgate 1 approved on]@row, 0, NETDAYS([Initial Project Presentation on]@row, [Tollgate 1 approved on]@row)), "N/A")

Answers

  • JamesB
    JamesB ✭✭✭✭✭✭
    Answer ✓

    @Ute

    In your AND argument you need to qualify both statements, and I needed to adjust some of the parentheses. Try this.

    =IF(AND(NOT(ISBLANK([Initial Project Presentation on]@row)),NOT(ISBLANK([Tollgate 1 approved on]@row))), IF([Initial Project Presentation on]@row = [Tollgate 1 approved on]@row, 0, NETDAYS([Initial Project Presentation on]@row, [Tollgate 1 approved on]@row)), "N/A")

  • Ute
    Ute ✭✭✭✭

    Fantastic! That solved it! Thank you so much!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!