You may also try these non array fomulas as well.

In J3

=SUMIF($D$2:INDEX($D$2:IV$2,LastCol-2),"Successful",$D3:INDEX($D3:IV3,LastCol))

In K3

=SUMIF($D$2:INDEX($D$2:IV$2,LastCol-2),"Total",$D3:INDEX($D3:IV3,LastCol))

Hit Ctrl+F3 and define LastCol : =MATCH("zzzzzz",Sheet1!$D$1:$IV$1)