A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
The reason is, in your conditional formatting criteria of Male and Female is not considered. Your conditional formatting is only based on column E and that also contains 2 sets, one from E3:E7 and the other one E8:E12, so when you sort it based on the age, then as criteria of Male and Female is not considered while giving rules, so you get wrong results.
To fix this problem, Don't use conditional formatting based on Values, instead Make 3 rules of "USE A FORMULA TO DETERMINE WHICH CELLS TO FORMAT"
1. =OR(AND(D3="male",E3<80),AND(D3="female",E3<65)) give format color as green
2. =OR(AND(D3="male",E3<100),AND(D3="female",E3<90)) give format color as yellow
3. =OR(AND(D3="male",E3<200),AND(D3="female",E3<200)) give format color as red
Please refer the file on this link