# Change cell colour display rule based on a number value in that field

**URL:** <https://forums.knack.com/t/change-cell-colour-display-rule-based-on-a-number-value-in-that-field/15505>\
**Category:** Knacksters' Idea Lab\
**Created:** [January 10, 2024, 7:23pm UTC](https://forums.knack.com/t/change-cell-colour-display-rule-based-on-a-number-value-in-that-field/15505 "2024-01-10T19:23:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon2](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@Simon2](https://forums.knack.com/u/Simon2)\
**Post date:** [January 10, 2024, 7:23pm UTC](https://forums.knack.com/t/change-cell-colour-display-rule-based-on-a-number-value-in-that-field/15505/1 "2024-01-10T19:23:29Z")

</div>

I know i’m probably missing a some obvious here!

I have a field (Days Until Due) that is an equation based on the number of days between two date, Order Date and Due date. I want to change the background of the cell in the table based on how many days are left until the due date to work like this…

If Days Until Due is greater than 5 then green  
If Days Until Due is between 1 and 4 then orange  
If Days Until Due is less than zero then red

I’ve tried using both the Days Until Due and the Due Date fields to base the logic but neither give me a between option or any way of saying something like greater than AND less than.

Ive also tried something like this to test it  
If Days Until Due = 4 then orange  
If Days Until Due = 11 then green  
In this case it doesn’t do either

Also im not just typing “green” i’m choosing a #12345 value.

Thank in advance for any guidance

---

<div class="post-metadata">

**Author:** ![Dean2](https://avatars.discourse-cdn.com/v4/letter/d/bcef8e/32.png) [@Dean2](https://forums.knack.com/u/Dean2)\
**Post date:** [January 10, 2024, 7:50pm UTC](https://forums.knack.com/t/change-cell-colour-display-rule-based-on-a-number-value-in-that-field/15505/2 "2024-01-10T19:50:50Z")

</div>

Hi Simon

Here’s what we do for something similar to your scenario, and hope it might help you.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/9/9cc196811688aaf722425bb11169ef6d8d1f9469.png)

Dean

---

<div class="post-metadata">

**Author:** ![Simon2](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@Simon2](https://forums.knack.com/u/Simon2)\
**Post date:** [January 10, 2024, 8:12pm UTC](https://forums.knack.com/t/change-cell-colour-display-rule-based-on-a-number-value-in-that-field/15505/3 "2024-01-10T20:12:49Z")

</div>

Excellent, thank you
