Using Case function to determine the color of a field

• 0
• Question
• Updated 2 years ago
I can't seem to get this formula working, I want if the the [Days Till Due] is greater then zero there is no change. If it is -1 or -2 then it is yellow and if it is -3 then it is red

```Case([Days Till Due], [Days Till Due] <= -3, "<div style=\"color:black; background-color:Red;\">&[Days Till Due]&</div>",
[Days Till Due] >= -2 and [Days Till Due] < 0,"<div style=\"background-color:Yellow;\">&[Days Till Due]&</div>", "")```
• 1,644 Points Posted 2 years ago

• 0
• 1,558 Points What type of field is "Days Till Due"?
• 1,644 Points It is a numeric calculation
• 31,698 Points Just a little syntax error.
Case([Field],

Try this:

Case([Days Till Due],
-3, "<div style=\"color:black; background-color:Red;\">&[Days Till Due]&</div>",
-2, "<div style=\"background-color:Yellow;\">&[Days Till Due]&</div>",
-1, "<div style=\"background-color:Yellow;\">&[Days Till Due]&</div>", "")
• 1,644 Points It partially worked in that the color did appear correctly when the due date was -1, I would like it so anything -3 or less would appear in red. So the -5 seen in the picture would appear in red, also with the numbers showing • 1,558 Points Try this:
```if(
[Days Till Due] <= -3, "<div style=\"color:black; background-color:Red;\">"&[Days Till Due]&"</div>",
[Days Till Due] >= -2 and [Days Till Due] < 0,"<div style=\"background-color:Yellow;\">"&[Days Till Due]&"</div>",
"")```
• 1,644 Points This worked! Thank you!