Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Cameron94
Partner - Contributor III
Partner - Contributor III

Help with IF statements

Im quite new to Qlik and this language in general, so forgive how naïve I am to think this IF statement would work but can someone give me some pointers? 

 

IF(Country = 'Iran', rgb(254, 113, 82),
IF(Country = 'Israel', rgb(254, 113, 82),
IF(Country = 'Israel', rgb(254, 113, 82),
IF(Country = 'Afghanistan', rgb(254, 113, 82),
IF(Country = 'Belarus', rgb(254, 113, 82),
IF(Country = 'Burundi', rgb(254, 113, 82),
IF(Country = 'Cambodia', rgb(254, 113, 82),
IF(Country = 'Chad', rgb(254, 113, 82),
IF(Country = 'Congo', rgb(254, 113, 82),
IF(Country = 'China', rgb(254, 113, 82),
IF(Country = 'Cuba', rgb(254, 113, 82),
IF(Country = 'Haiti', rgb(254, 113, 82),
IF(Country = 'Hong Kong', rgb(254, 113, 82),
IF(Country = 'Kazakhstan', rgb(254, 113, 82),
IF(Country = 'Libya', rgb(254, 113, 82),
IF(Country = 'Macau', rgb(254, 113, 82),
IF(Country = 'Mauritania', rgb(254, 113, 82),
IF(Country = 'Moldova', rgb(254, 113, 82),
IF(Country = 'Nicaragua', rgb(254, 113, 82),
IF(Country = 'Niger', rgb(254, 113, 82),
IF(Country = 'Nigeria', rgb(254, 113, 82),
IF(Country = 'North Korea', rgb(254, 113, 82),
IF(Country = 'Pakistan', rgb(254, 113, 82),
IF(Country = 'Palestine', rgb(254, 113, 82),
IF(Country = 'Russia', rgb(254, 113, 82),
IF(Country = 'Somalia', rgb(254, 113, 82),
IF(Country = 'South Sudan', rgb(254, 113, 82)),
IF(Country = 'Sudan', rgb(254, 113, 82),
IF(Country = 'Syria', rgb(254, 113, 82),
IF(Country = 'Tajikistan', rgb(254, 113, 82),
IF(Country = 'Turkmenistan', rgb(254, 113, 82),
IF(Country = 'Ukraine', rgb(254, 113, 82),
IF(Country = 'Ukraine', rgb(254, 113, 82),
IF(Country = 'Uzbekistan', rgb(254, 113, 82),
IF(Country = 'Venezuela', rgb(254, 113, 82),
IF(Country = 'Yemen', rgb(254, 113, 82),
IF(Country = 'Zimbabwe', rgb(254, 113, 82)))))))))))))))))))))))))))))))))))))

Error message shows, IF takes 2-3 parameters.

 

I have gathered I probably shouldn't write it like this, so does anyone have any pointers? 

1 Solution

Accepted Solutions
aguirre
Creator
Creator

there is one  parethesis too many here

 

IF(Country = 'South Sudan', rgb(254, 113, 82)),

it should be 

IF(Country = 'South Sudan', rgb(254, 113, 82),

 

SUrely there is a bettere way to do it, but I guess it depends on what you want to achieve...

 

View solution in original post

5 Replies
aguirre
Creator
Creator

there is one  parethesis too many here

 

IF(Country = 'South Sudan', rgb(254, 113, 82)),

it should be 

IF(Country = 'South Sudan', rgb(254, 113, 82),

 

SUrely there is a bettere way to do it, but I guess it depends on what you want to achieve...

 

Cameron94
Partner - Contributor III
Partner - Contributor III
Author

I looked at it for over 30 minutes, how did I not see that!

 

Thanks a lot! 

aguirre
Creator
Creator

well Frank then flag my reply as accepted solution and not yours 😀

Cameron94
Partner - Contributor III
Partner - Contributor III
Author

I am dying with shame here, one too many late nights I think. 

 

Thanks again, have a great weekend! 

aguirre
Creator
Creator

you too Frank😉