You don't say how you get YES or NO but this formula looks at A1 and if the
result of a formula in that cell is YES or No or there is a text Yes or No
then this returns 1 or 0
Mike has given you a method of carrying out the conversion.
If you are wanting to do this just so you can count the number of Yes
values, you don't need to convert to numbers first
=COUNTIF(A:A,"Yes") will count the number of Yes values in column A.
Substitute "No" for the alternative result.