Page 1 of 1

Calculated column as range with IIF function

Posted: Tue Aug 04, 2015 10:39 am
by victorinable
Hi,

I'm trying to create a calculated column which will indicate the age range. This is done to create a Cross-Data Table, to evaluate the age of a population based on it's sex. I tried to do this:

IIF(Datos_Personales.Edad_Años < 19 ,"<19",
IIF(Datos_Personales.Edad_Años >= 19 & Datos_Personales.Edad_Años <= 21,"19-21",
IIF(Datos_Personales.Edad_Años >=22 & Datos_Personales.Edad_Años <= 24 ,"22-24",">24")
)
)

But all the registers are being marked as "19-21". Can you please explain me if I'm doing something wrong or if this is even possible to do? Other possibility was to create this condition on the Rows of the Tab, but it's still failing to do what I want to.

Thanks in advance.

Re: Calculated column as range with IIF function

Posted: Tue Aug 04, 2015 11:04 am
by victorinable
Hi,

I found what was wrong... Operator "&" should be changed by literal "And".

Now it's working fine, I just missuderstood logical operators.

Thanks.

Re: Calculated column as range with IIF function

Posted: Tue Aug 04, 2015 12:15 pm
by Andrew
Hello,

Thank you for sharing your way of solving the problem.