Discussions

Expand all | Collapse all

Formula Duration in a nested if statement

  • 1.  Formula Duration in a nested if statement

    Posted 10-29-2018 02:17
    I have a formula that calculates the duration if the checkbox is checked.  

    If([Appraisal Received]=true, (ToDays(([Appraisal Due Date]-[Appraisal Received Date]))))

    I am trying to run a nested if statement that will output " ON TIME" is the result is <=0, or display the calculated duration past the due date in a red background with white letters.

    Thank you,




  • 2.  RE: Formula Duration in a nested if statement

    Posted 10-29-2018 13:35
    Problem:

    If([Appraisal Received]=true, (ToDays(([Appraisal Due Date]-[Appraisal Received Date]))))
    -------------------------------------------
    Solution:

    Because the desired result is a rich text, the best route would be to create a formula - Rich Text field.
    It's also best to define variables to separate and define the segments of the argument. 

    Also, a solution to get a red background with white font would be to use a <p> tag with style attribute and concatenate into the formula. 

    Try the following:
    -------------------------------------------


    Var Duration Days = ToDays([Appraisal Due Date]-[Appraisal Received Date]);

    Var text Output1 = ToText($Days);

    If($Days <= 0, "ON TIME",  "<p style='background-color:red;color:white'>"+$Output1+"</p>");

    ---------
    this may not work initially due to some possible syntax errors but this should point you in the right direction.