Forum Discussion

ArchiveUser's avatar
ArchiveUser
Qrew Captain
8 years ago

How do i change text color based on formula result

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. 
  • ChrisChris's avatar
    ChrisChris
    Qrew Assistant Captain

    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.