Do you want it to be John that's not married, or just whatever name is in column B?

You might need to provide a larger sample so we can see your desired results.

Try this in cell D5 and drag it down:

=if(C5="Married","M","NM")
That will work if all you want is it to return M or NM based on the cell in the C column.

I believe you are trying to return if they are married to one another, so that might require a function other than if. Once again, we need a larger sample size to see what you are actually expecting as results.