# If and statement

Brass Contributor

# If and statement

Hello! I needed assistance with creating a formula cell o2, essentially, I need "yes or no" to auto populate IF there is a date in symptom onset (q2) AND M2 is not blank, otherwise I just want the cell to be blank.

4 Replies

# Re: If and statement

essentially, I need "yes or no" to auto populate IF there is a date in symptom onset (q2) AND M2 is not blank, otherwise I just want the cell to be blank.

A little more description of conditions is needed, I think. You want one of three results in cell O2

• yes
• no
• blank

but you only give two conditions: it's to remain blank unless there's a date in Q2 and M2 is not blank, but what combination of Q2/M2 creates the "Yes" and what creates the "No"?

# Re: If and statement

the yes is created by have a number in m2 and a date in q2

# Re: If and statement

and the no would be if there is a number in M2 and No date in q2 @mathetes

# Re: If and statement

See attached.

This is the formula in cell O2

=IFS(

AND(ISNUMBER(M2),ISNUMBER(Q2)),"Yes",

AND(ISNUMBER(M2),ISBLANK(Q2)),"No",

AND(ISBLANK(M2),ISBLANK(Q2)),""

)

Note that this is an IFS function, which handles multiple conditions very easily. This means you could add more combinations, more consequences, just be spelling them out.

I also use Data Validation to make sure there are numbers, or a date, in columns M and Q respectively.