Forgive the notation bu you should get the idea.

=IF(MID(RC[-4],3,1)="D",300000,0)