Using Excel 365 (not sure if it's going to work for other versions):
=IF(SUM(IF((B4:E4="D")*(OFFSET(B4:E4,0,-1)="D"),1,0))>0,"Demotion","n/a")