# Discussions

View Only

## Formula Help

• #### 1.  Formula Help

Posted 05-01-2019 17:55
I am trying to write a formula to turn items a color if they meet certain criteria. With our app, we have task lists that are on each Quick Base record. I have a report built that shows certain tasks and their current status and how long they have been in that status. I would like to alter the report so that when a duration (how long the task has been in that status) exceeds a set number, it turns that line red. There are multiple different tasks that show up on this report and each task would have a different set number so there will likely need to be several formulas.

This is the format (in layman's terms):

"if" the task name is Design "and" the Duration is greater than 2 days "then" turn red.

In this example, Design represents a task that is included in all versions of the task lists and Duration is a "Formula - Duration" field.

• #### 2.  RE: Formula Help

Posted 05-01-2019 18:41
np,

IF("Task Name]="Design" and [Duration] > Days(2), "FFAEB9") // pink

That formula above assumes that the field type for the duration is a duration field type.  If it is numeric field type representing the number of days, then the formula would be

IF([Task name]="Design" and [Duration] > 2, "FFAEB9") // pink

You can use "red' for the color, but its such a dark red that you can barely
read the words.  Laura ( another fine QSP) has a great tool to select colours here https://laurahillier.quickbase.com/db/bhy8pumuk?a=q&qid=1  you just put in the hex code for the color.  I like to comment the color as who remembers that those codes mean when you go back later to edit it!!

The // at the start or anywhere in a formula line means that it's a comment and Quick Base will ignore for Syntax checking

Then if you have multiple criteria it would look like this

IF(
[Task name]="Design" and [Duration] > 2,   "FFAEB9", // pink
[Task name]="Install"   and [Duration] > 10, "FFAEB9", // pink
[Task name]="Invoice" and [Duration] > 1,   "FFAEB9") // pink