Or use conditional formatting.

1 Select all the rows in column C you want to check.

2 Goto Format>Conditional formatting.

3 Select formula is from the dropdown.

4 Enter this formula.

=AND(C1<>"Y", C1<>"M")

5 Format as required.

PS You do realise Excel has Data>Validation...