First thing if you use "20-30" and "30-40" as criterea you will get everyone age 30 showing in both categories!
You need to adjust it so it is something like ">=20 and< 30" etc...
If you have their ages listed in column C starting at cell C2
then start a new column(D) for "AGEGROUP" and enter in D2:
=IF(C2<20,"ERROR",IF(AND(C2>=20,C2<30),"Group1",IF(AND(C2>=30,C2<40),"Group2",IF(AND(C2>=40,C2<50),"Group3",IF(AND(C2>=50,C2<60),"Group4","Over60")))))
[there are NO spaces in the formula! But I can't stop them appearing on AAM for some reason!!!]
Anyone less than 20 will show up with ERROR
Anyone >=20 and <30 will show up with Group1
Anyone >=30 and <40 will show up with Group2
Anyone >=40 and <50 will show up with Group3
Anyone >=50 and <60 will show up with Group4
Anyone <60 will show up with Over60
You can copy or autofill the formula down column D. You can then sort and/or autofilter and/or group by column D
HTH