View Full Version : IIf function with 3 choices
dehere
21st March 2004, 12:09.29 PM
Can anyone help me with an IIF function? I would like to show the Age of a race in text format in a report. In other words I want to show "3 and up", "3 yr. old" or "2 yr. old" in a report. How do I get the IIf function to return those text entries. I can do so when I have only two choices, like with sex and get the report to show M or F, but how do I get IIf to work with three choices? If there is some other function than IIf to do this that would be cool to know as well. Thanks for any help.
Donnie
21st March 2004, 12:19.51 PM
You need to nest an IIf function within an IIf function.....like this....
IIF(test, truepart, (IIf (test, truepart, falsepart)))
IIF(Conditions="2yrold","2yrold",(IIF(Conditions="3yrold","3yrold","4yrold")))
Donnie
21st March 2004, 12:44.07 PM
Oops!
Slight modification:
IIF(test, trupart, IIf(test, truepart, falsepart))
I put one too many sets of parentheses in the first example!
dehere
21st March 2004, 12:45.53 PM
That is so cool - thanks a bunch Donnie - now for a somewhat unrelated question regarding the "new" SOR ratings in the PP's. I do not see a change in the header for PER (prior) to SOR (current) in the HX5 table. Are these number now the SOR ratings or is there somewhere else I get those ratings?
dehere
21st March 2004, 12:51.12 PM
I don't know if anyone else will ever have a use for this function or not - but this is the final function which I used and which perfectly returned the age restrictions of the specific race.
Age: IIf(ALL_HX4!nAGE=1,"3 or 4 & up",(IIf(ALL_HX4!nAGE=2,"2 yr old","3 yr old")))
Not sure why, but the extra parenthesis didn't seem to impact the result.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.