Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statement to color cells red or green

Hello,

I have an expression in the custom format cell area of my table and I want it to color the cell red if the value is 'N' and green if the value is 'Y'.

if

(Complete = 'N', red(), if(Complete = 'Y', green())


I have this expression that works, except if one value is 'Y' it colors the entire column green instead of just the individual cell.  Anyone have any idea why this is happening?

1 Solution

Accepted Solutions
engishfaque
Specialist III
Specialist III

Dear Brandon,

Go to your your "Expression" > Background Color > Write your "expression" for color change as showed in the image > OK > Apply > OK.

Cell Color Change.png

Kind regards,

Ishfaque Ahmed

View solution in original post

7 Replies
Clever_Anjos
Employee
Employee

What kind of table are you using?

Not applicable
Author

a straight table

Clever_Anjos
Employee
Employee

Did you try using "Visual Cues" tab?

jpapador
Partner - Specialist
Partner - Specialist

Instead of using the custom format cell function go to the expressions tab and enter your expression in background color

Click the plus next to the expression you want to conditionally color and then click on background color and paste your expression into the definition box.

engishfaque
Specialist III
Specialist III

Dear Brandon,

Go to your your "Expression" > Background Color > Write your "expression" for color change as showed in the image > OK > Apply > OK.

Cell Color Change.png

Kind regards,

Ishfaque Ahmed

krishna20
Specialist II
Specialist II

Hi,

If the above suggestions doesn't work for you.

Go to the expression tab and expand your expression by clicking at '+ '. Choose text format apply like this

if((Complete= 'N',Red(),Green())

Hope this helps

Regards

Krishna

tyagishaila
Specialist
Specialist

Try this expression,


if(Complete = 'N', red(), green())