Discussions

Expand all | Collapse all

How do i change text color based on formula result

  • 1.  How do i change text color based on formula result

    Posted 11-01-2017 00:49
    I have a formula for figuring out how long a task has been opened.

    If(([Status]="Completed"),[Date Complete]-[Start],Today()- [Start]))

    How do I add to this formula that the number should change color based on days open. For example if the task is open for more then 14 days change to red. 


  • 2.  RE: How do i change text color based on formula result

    Posted 11-01-2017 14:06

    This would no longer be a formula date field but a formula text field. Anything with color, not using script, would be text. Someone else here can probably provide you the jquery or js to do that. But here is out of the box QB using formula text.

    If(

    ([Status]="Completed"),

    "<div style='color:#FF0000'>" & [Date Complete]-[Start] & "</div>",

    "<div style='color:#0000FF'>" & Today() - [Start] & "<div>"

    )


    Try this and see if you get the results you want. Notice the single quotes around the color styles. Again, you have to set the data type to formula text and turn on "allow html".

    Hope this helps.