Try this:
=SUM(IF(RIGHT(C6:C9,1)="1",D6

9,0))
This is an array formula and should be entered with CTRL-SHIFT-ENTER instead
of just Enter. If done properly, the formula should be surrounded by { }
Or, another option:
=SUMPRODUCT(--(RIGHT(C6:C9,1)="1",(D6

9))
HTH,
Elkar