Formula Duration in a nested if statement

  • 0
  • 1
  • Question
  • Updated 1 month ago
  • In Progress
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,


Photo of Eric Fixler

Eric Fixler

  • 82 Points 75 badge 2x thumb

Posted 1 month ago

  • 0
  • 1
Photo of Claude

Claude

  • 70 Points
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. 
(Edited)