IF Formula error

Copper Contributor

I am trying to group ages in a column in a worksheet.  I have tweaked the following formula, but keep getting an error message.  I am not sure what I am doing wrong.  I am trying to increase my knowledge and do some analytics work, but I have missed something.

 

This is the formula.  Any suggestions?

 

=IF(ISBLANK(E2),"NULL",IF(E2<2,"Infant"),IF(E2>2<12 ,"Child"),IF(E2>12<18, "Teen"),IF(E2>18,"Adult"))

2 Replies

@jdmitchell1 

Try this formula in S2 on the "titanic3" sheet.

=IF(ISBLANK([@age]),"NULL",IFERROR(IFS([@age]<2,"Infant",[@age]<12,"Child",[@age]<=18,"Teen"),"Adult"))

 

@jdmitchell1 

As variant

=IF(ISBLANK([@age]),"NULL", LOOKUP([@age],{0,2,12,18},{"Infant","Child","Teen","Adult"}))