Here is one approach:

=SUMPRODUCT(($D$2:$D$18<2009012)*($E$2:$E$18=A2)*(($G$2:$G$18="ATP")+($G$2:$G$18="TTP")),$F$2:$F$18)