I'm trying to nest several columns into an If statement that utilizes both And and Or functions. I'm so far unable to come up with a function that works.
Rules:
- If Act Conf Years OR Act Conf Months > 0 then output "Confinement"
- If Act Prob years OR Act Prob Months > 0 then output "Probation"
- If (Act Conf Years OR Act Conf Months > 0 ) AND (Act Prob years OR Act Prob Months >0) then output "Both"
The formula I came up with was:
IF(OR(D3>0,E3>0),"Confinement",IF(OR(G3>0,H3>0),"Probation",IF(OR(D3>0,E3>0,AND(G3>0,H3>0),"Both"))
However, that doesn't work. I know the issue is somewhere in the part after "Probation". But am not sure how to appropriately stack the OR and AND functions.
Alternatively, can this somehow be done with Power Query, Power Pivot, or some other add on?
IF(OR(D3>0,E3>0),"Confinement",IF(OR(G3>0,H3>0),"Probation",IF(And(OR(D3>0,E3>0),OR(G3>0,H3>0)),"Both"))
? I think the issue is your final statement - you doOr(And)
and it should beAnd(or(),or())
I think.