Forum Discussion
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"?
- jaolveraAug 18, 2023Brass Contributorthe yes is created by have a number in m2 and a date in q2
- jaolveraAug 18, 2023Brass Contributorand the no would be if there is a number in M2 and No date in q2 mathetes
- mathetesAug 18, 2023Silver Contributor
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.