|I'm not sure what you are trying to do.|
An IF statement has this syntax:
IF(logical_test, [value_if_true], [value_if_false])
In your case:
logical_test = P5=AE5
value_if_true = Y
value_if_false = Q5=""
Therefore if P5=AE5 the value_if_true will be returned and you will get Y.
However, if P5<>AE5, the IF will return the value_if_false which in your case is essentially a question: Does Q5 = ""?
If P5<>AE5 and Q5 is empty, then you will get TRUE. If P5<>AE5 and Q5 is not empty, you will get FALSE.
What exactly are the conditions for which you want a Y or an N?
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.