Hi All,
I was wondering if anyone knows of a way to do a multi-condition 'IF THEN ELSE' statement in the formula tool,
I want to replace the contents of a string but only if two conditions are met, so for example:
Output Field
[FIELD 1]
IF [FIELD 2] = "X" and [FIELD 3] = "Y" THEN "Replacement Text" ELSE [FIELD 1] ENDIF
Alternitivly is there a better way to acheive this?
Thanks in advance...
Solved! Go to Solution.
Your solution looks good to me. I don't think you can simplify it further than that.
Hi John,
Thanks for the quick response - when I was typing it as I did in the example I was getting an error about an unrecognised variable "and" so assumed there had to be another way to do this. After you pointed out this was the correct way to do it I retyped the formula and this time it worked - must have been a typo in there!
Thanks again.
Wild guess: a space in the "ENDIF" ... that one has gotten me often enough to be memorable.
Hah, quite possibly
I tend to prefer the IIF for simple statements as have made that mistake too often!
In a nutshell:
IF c THEN t ELSE f ENDIF
(is the same as)
IIF(c,t,f)
User | Count |
---|---|
19 | |
15 | |
15 | |
9 | |
8 |