I need to display red and green icons based on date created and date created + 5 Days

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

I need to display a red or green icon based on expiration, The two field i use are date created and the no of days for expiration are 5 days hence date created + 5 days. I need a formula that does the following :

IF [Date Created] is in between [Date Created] and [Date Created] + Days(5), Green, Red.

Photo of JW

JW

  • 140 Points 100 badge 2x thumb

Posted 4 years ago

  • 0
  • 1
Photo of Jack

Jack, Champion

  • 50 Points
Hi,

This should give you what you want.

Create a formula text field with HTML enabled (tick box in field settings). This will give green circle if within 5 days and red circle if over 5 days.

If(
Today()-[Date Created]>days(5),"<div><img src=\"https://images.quickbase.com/si/24/221-point_red.png\"></div>","<div><img src=\"https://images.quickbase.com/si/24/222-point_green.png\"></div>")


If you then need to create a report which say shows only red ones or green ones using this formula, create a duplicate formula text field but replace the HTML with the word "red" and the word "green", then use this as the filter for your report.
Photo of Jack

Jack, Champion

  • 50 Points
Note if the above doesn't quite work you may need to encompass the date formula in days as below:

If(
Days(Today()-[Date Created])>days(5),"<div><img src=\"https://images.quickbase.com/si/24/221-point_red.png\"></div>","<div><img src=\"https://images.quickbase.com/si/24/222-point_green.png\"></div>")
Photo of Jeff

Jeff

  • 20 Points
Hi,

Another way to write this would be:

If(
Today()<Todate([Date Created]+days(5)),"<div><img src=\"https://images.quickbase.com/si/24/221-point_red.png\"></div>","<div><img src=\"https://images.quickbase.com/si/24/222-point_green.png\"></div>")