I suppose you could try something like:
=IF(AND(ISNUMBER(SEARCH("P",A1)),NOT(MID(A1,SEARCH("P",A1)+1,1)="M")),"Material","")