=IF(AND(B2>=7,C2>=7),9,IF(AND(B2>=7,C2<7,C2>=5),7,IF(AND(B2>=7,C2<5),4,IF(AND(B2<7,B2>=5,C2>=7),8,IF(AND(B2<7,B2>=5,C2<7,C2>=5),5,IF(AND(B2<7,B2>=5,C2<5),2,IF(AND(B2<5,C2>=7),6,IF(AND(B2<5,C2<7,C2>=5),3,IF(AND(B2<5,C2<5),1,0)))))))))