Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF statement as a Variable for Background Colour

 

I have the following If which is setting the background colour in my straight table.

 

IF(FORECAST_STATUS='CONFIRMED FDD',rgb(200,240,200),
IF(FORECAST_STATUS='UNCONFIRMED FDD',rgb(255,153,0),
IF(FORECAST_STATUS='NO FDD',rgb(255,80,80),'')))';

 

On its own it works fine but so that I don’t have to amend it 2 dozen times I assumed I could set it as a Variable and apply the variable to the background colour instead.

 

The set variable is scripted as follows in the first tab:

 

SET vFDDSTATUS = '=IF(FORECAST_STATUS='CONFIRMED FDD',rgb(200,240,200),
IF(FORECAST_STATUS='UNCONFIRMED FDD',rgb(255,153,0),
IF(FORECAST_STATUS='NO FDD',rgb(255,80,80),'')))';

 

My main concern is that FORECAST_STATUS doesn’t exist this early………………or is that not a concern when setting variable?

 

Thank You

 

1 Solution

Accepted Solutions
Not applicable
Author

worked it out:

SET vFDDSTATUS = IF(FORECAST_STATUS='CONFIRMED FDD',rgb(200,240,200),
IF(FORECAST_STATUS='UNCONFIRMED FDD',rgb(255,153,0),
IF(FORECAST_STATUS='NO FDD',rgb(255,80,80),'')));

then use variable as such:

=$(vFDDSTATUS)

View solution in original post

6 Replies
sunny_talwar

It should not be a problem if FORECAST_STATUS doesn't exists. What might be a concern is that fact that you have single quote within the single quote here. Not sure how it will behave, but give it a shot and see what happens?

Not applicable
Author

Afternoon,

oh it definitely doesn't work but I am not getting a failure and the variable is being created.

Like I say, using the statement on it own in the Background Colour setting works fine.

sunny_talwar

Do you see the variable in the variable overview? How does it look within the variable overview?

Not applicable
Author

admittedly in the overviewer the first and last '' exist so it may be that..............

sunny_talwar

Then try it like this and see what happens

SET vFDDSTATUS = =IF(FORECAST_STATUS='CONFIRMED FDD',rgb(200,240,200),
IF(FORECAST_STATUS='UNCONFIRMED FDD',rgb(255,153,0),
IF(FORECAST_STATUS='NO FDD',rgb(255,80,80),'')));

or

SET vFDDSTATUS = IF(FORECAST_STATUS='CONFIRMED FDD',rgb(200,240,200),
IF(FORECAST_STATUS='UNCONFIRMED FDD',rgb(255,153,0),
IF(FORECAST_STATUS='NO FDD',rgb(255,80,80),'')));

Notice that the second expression doesn't have an equal sign

Not applicable
Author

worked it out:

SET vFDDSTATUS = IF(FORECAST_STATUS='CONFIRMED FDD',rgb(200,240,200),
IF(FORECAST_STATUS='UNCONFIRMED FDD',rgb(255,153,0),
IF(FORECAST_STATUS='NO FDD',rgb(255,80,80),'')));

then use variable as such:

=$(vFDDSTATUS)