# Getting Started

View Only

## Formula: Color Coding and Dates

• #### 1.  Formula: Color Coding and Dates

Posted 01-05-2022 14:53
Hello All! I am new to Quickbase and I am having trouble finding out how to code. I need to make a report that tracks all employees and how long they have worked at my company. I have the basic information, (I.e. Start date, employee, etc.) but I was wondering of there would be an easier way to automatically calculate how long the employee has worked from when they were hired until the present date. I also need to find out how to code those times in to different sections  (green= 0-1 years, blue= 1-5, etc) so I can graph that info. If anyone has any suggestions or can point me in the right direction to go that would be amazing! Thanks

• #### 2.  RE: Formula: Color Coding and Dates

Posted 01-05-2022 14:57

------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------

• #### 3.  RE: Formula: Color Coding and Dates

Posted 01-05-2022 17:40
Thank you! Do you know if there is a way to color code the numbers in a field? For example, an employee has worked for 5-10 years the field would be green, etc.

• #### 4.  RE: Formula: Color Coding and Dates

Posted 01-05-2022 18:03
Just want to colour a single field it's a little more complicated than XL. You're actually need to create a formula rich text field and use a formula as described here.

https://help.quickbase.com/user-assistance/color-coding_fields.html

Here is another example

var text ColorCode =

If(

[Delivery Date]-Today()<Days(1),"pink",

[Delivery Date]-Today()<Days(3),"yellow",

[Delivery Date]-Today()<Days(5),"green");

var text DateText = ToText([Delivery Date]);

Case(\$ColorCode,

"pink","<div style=\"background-color: pink;\"" & ">" & \$DateText & "</div>",

"yellow","<div style=\"background-color: yellow;\"" & ">" & \$DateText & "</div>",

"green","<div style=\"background-color: #00C957;\"" & ">" & \$DateText & "</div>", \$DateText)

------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------