If
Excel
=~IF!~(‹logical_test›, ‹when_true›, ‹when_false›) OR (multiple conditions) =~IF!~(‹logical_test1›, ‹when_true1›, ~IF!~(‹logical_test2›, ‹when_true2›, ‹when_false2›))
Tableau
~IF!~ ‹logical_test› ~THEN!~ ‹when_true› «ELSE when_false» ~END!~ OR (multiple conditions) ~IF!~ ‹logical_test1› ~THEN!~ ‹when_true1› ~ELSEIF!~ ‹logical_test2› ~THEN!~ ‹when_true2› ~ELSE!~ ‹when_false› ~END!~
Alteryx
~IF!~ ‹logical_test› ~THEN!~ ‹when_true› ~ELSE!~ ‹when_false› ~ENDIF!~ OR (multiple conditions) ~IF!~ ‹logical_test1› ~THEN!~ ‹when_true1› ~ELSEIF!~ ‹logical_test2› ~THEN!~ ‹when_true2› ~ELSE!~ ‹when_false› ~ENDIF!~
OrgVue
~if!~(‹logical_test›){‹when_true›} ~else!~{‹when_false›} OR (Shorthand / ternary syntax) ‹logical_test› ? ‹when_true› : ‹when_false› OR (multiple conditions) ~if!~(‹logical_test1›){‹when_true›} ~else if!~(‹logical_test2›){‹when_true2›} ~else!~{‹when_false›}
OR (Shorthand / ternary syntax)
OR (multiple conditions)
tSQL
~IF!~ ‹logical_test1› ~BEGIN!~ ‹when_true1› ~END!~ (Repeat above code for IF...ELSE statement)
Python
In the example below, new line breaks and indents are needed for the syntax to work correctly (line indentation takes the place of curly braces {}
in Python). Indents are four spaces.
~if!~ ‹logical_test›:
‹when_true›
~else!~:
‹when_false›
OR (multiple conditions)
~if!~ ‹logical_test1›:
‹when_true1›
~elif!~ ‹logical_test_2›:
‹when_true2›
~else!~:
‹when_false!~
Last updated
Was this helpful?