Wednesday, 30 September 2009

Nested IF statement for Lotus Approach

Used this to set the age group based ages.

If(RHBKKK._8_Age < 10, 'Kanak-Kanak',
(If(RHBKKK._8_Age >= 10 and RHBKKK._8_Age <= 14, 'Awal Remaja',
(If(RHBKKK._8_Age >= 15 and RHBKKK._8_Age <= 17, 'Remaja',
(If(RHBKKK._8_Age >= 18 and RHBKKK._8_Age <= 19, 'Lewat Remaja',
(If(RHBKKK._8_Age >= 20 and RHBKKK._8_Age <= 59, 'Dewasa',
(If(RHBKKK._8_Age >= 60 and RHBKKK._8_Age <= 74, 'Awal Warga Emas', 'Lewat Warga Emas'
)))))))))))

Note that the end paranthesis is 2n-1, where n= number of ifs.

0 comments: