Try the following array formula


{=SUM(IF(D5:D13="Yes",C5:C13))}

Ctl+Shift+Enter



HTH