Nested IF statement to check two cells

I need to check two cells in each row, and return “YES” if either have contents, or “NO” if both are empty. Have been trying nested IF statements using OR, but cannot seem to get it to return the correct statement. I know there are several ways of doing this, but think the IF function is probably the easiest.

Suggestions?

Hello,

try this

=IF(AND(ISBLANK(A1);ISBLANK(B1));"NO";"YES")

Hope that helps.

if you like it nested:
=IF(A1<>"";"YES";IF(A2<>"";"YES";"NO")) or
=IF(A1="";IF(A2="";"NO";"YES");"YES"),
but ‘grouping’ arguments for results as @igorlius or
=IF(OR(A1<>"";A2<>"");"YES";"NO") is ‘better’,
if you ever write bigger ‘programs’, it makes a big difference in which thinking logic you approach each problem …
several ways:
=IF(A1&A2<>"";"YES";"NO") or
=IF(A1&A2="";"NO";"YES")

Thank you.

@igorlius nitpick: please use the ; semicolon function parameter separator in examples, instead of the , comma separator. Reason is that independent of the localized separator configuration the semicolon is always accepted. Thanks.

@erAck, Sound reasoning. I’ll try to keep it in mind from now on. Thanks.