try array-entering into a cell somewhere:
=SUM(IF(FREQUENCY(IF((IF(($D$5:$D$26="Terminada")*($C$5:$C$26> C3)*($C$5:$C$26<= D3)=1,$B$5:$B$26,""))<>"", MATCH((IF(($D$5:$D$26="Terminada")*($C$5:$C$26> C3)*($C$5:$C$26<= D3)=1,$B$5:$B$26,"")),(IF(($D$5:$D$26="Terminada")*($C$5:$C$26> C3)*($C$5:$C$26<= D3)=1,$B$5:$B$26,"")),0)),ROW(B5:B26)-ROW(B5)+1),1))
This works on the extended data I talked about earlier and ignores blanks in column B (they don't go towards the count).
I'm sure it could be shorter, which I'll leave to others.
A user-defined-function written in VBA might be more friendly.