This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
hi,
I am getting malformed if statement on the below:
If [FOLDER] = "Test1" OR [FOLDER] = "Test2" THEN
if Contains([n_Value],"read")
or Contains([n_value],"inquiry")
or Contains([n_value],"view")
or Contains([n_value],"no access")
or Contains([n_value],"report")
then "Yes"
else "No"
OR
If [FOLDER] = "Test3"
THEN
if Contains([n_Value],"EXEC")
or Contains([n_Value],"WRITE")
then "No"
else "Yes"
endif
How can I fix this?
Solved! Go to Solution.
You can use the following If formula to get the results you want
@wonka1234 Edit: I miss-spoke when I was talking about the nested IF Statements and after careful review and looking at @dYoast's answer, you are missing an ENDIF after that 2nd grouping of IF statements and you need to use an ELSEIF instead of that last OR.
I would split into two formula statements.
Statement 1:
If ([FOLDER] = "Test1" OR [FOLDER] = "Test2") AND [n_Value] IN ("read", "inquiry", "view", "no access", "report") THEN
"Yes"
else "No"
ENDIF
Statement 2:
If [FOLDER] = "Test3" AND [n_Value] IN ("EXEC", "WRITE") THEN
"No"
else "Yes"
endif
But, if you want to try your original, this may work:
If [FOLDER] = "Test1" OR [FOLDER] = "Test2" THEN
if Contains([n_Value],"read")
or Contains([n_value],"inquiry")
or Contains([n_value],"view")
or Contains([n_value],"no access")
or Contains([n_value],"report")
then "Yes"
else "No"
ENDIF
ELSEIf [FOLDER] = "Test3" THEN
if Contains([n_Value],"EXEC")
or Contains([n_Value],"WRITE")
then "No"
else "Yes"
ENDIF
ELSE "Not Applicable"
endif