Skip to main content
Question

Formula Duration in a nested if statement

  • October 29, 2018
  • 0 replies
  • 82 views

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,


This topic has been closed for replies.

  • Quickbase Alumni
  • October 29, 2018
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.