I want to write an IF OR Statement for the below table.
Name | Class | Subject | Roll | Division | school | tuition | fees | Type |
Ravi | Y | Y | ||||||
Rohit | Y | Y | Y | |||||
Rajesh | Y | Y | Y | |||||
Deepak | Y | |||||||
Amit | Y | |||||||
Alok | Y |
Now, I have to create an Output field name "Type" for which three values should be calculated which is "N", "NNC" and "U" based on the column Class to fees as below:
If class = Y or Subject = Y or Roll=Y or Division=Y then "NNC"
Elseif school=Y or tution=Y or fees=Y then "NC"
Else "U"
I am getting error on above formula....Is there a better way to calculate above formula ?
Solved! Go to Solution.
Hey @Ravy12!
Try the below expression in your Formula tool:
iif([Class]="Y" || [Subject]="Y" || [Roll]="Y" || [Division]="Y","NNC",IIF([school]="Y" || [tuition]="Y" || [fees]="Y","NC","U"))
Three things:
1- Add quotes around each "Y" if these are strings fields. If they are booleans, pull out " = Y" altogether from each.
2- Add "ENDIF" at the end. Alteryx makes you specifically end your if statement.
3- If this is a straight copy and paste, it looks like tuition needs another "i". tution -> tuition.
So if these are sting fields, try:
If class = 'Y' or Subject = 'Y' or Roll='Y' or Division='Y' then "NNC"
Elseif school='Y' or tuition='Y' or fees='Y' then "NC"
Else "U" endif
And if these are booleans
If class or Subject or Roll or Division then "NNC"
Elseif school or tuition or fees then "NC"
Else "U" endif
Good luck!