Change the color of a cell?

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

Want to change the cell color depending on the result of the formula.

If(Today() - [FS Re-Up]<Days(365), "Good", ToText(ToDays(Today() - [FS Re-Up])))

I want the cell to be green if good and red if not.

Is this possible?

Photo of Tony

Tony

  • 0 Points

Posted 4 years ago

  • 0
  • 1
Photo of QB_Support_Brian

QB_Support_Brian

  • 20 Points
Hi Tony,



Sure! If the cell should display "Good" with a green background if your condition is met, and "Not Good" with a red background when it is not met, you can use this formula:



If(

Today() - [FS Re-Up]<Days(365),"<span style=\"background-color:#9BEB79; \">Good</span>",



"<span style=\"background-color:#EB9079; \">Not Good</span>"

)

On the other hand, if you need to color the background of another field, you would write: If(

Today() - [FS Re-Up]<Days(365),"<span style=\"background-color:#9BEB79; \">" & [other field] & "</span>",



"<span style=\"background-color:#EB9079; \">" & [other field] & "</span>"

)

Thanks!Brian
Photo of QB_Support_Brian

QB_Support_Brian

  • 20 Points
By the way, when I was testing this out I used shades of green and red that weren't too hard on the eyes. You can use this free tool to select a specific hue you'd like, and paste the six-digit code after the hashtag in your formula:

http://www.colorpicker.com/
Photo of Tony

Tony

  • 0 Points
Thank you! However, is there anyway it can still return the difference instead of saying "not good"? I want "good" to show up with green bg color (like you have it) or the actual number to show with red bg. That way I can tell at a glance how many days past the deadline they are. Thank you in advance.
Photo of Tony

Tony

  • 0 Points
Never mind I got it worked out. Thank you.