I am trying to create a nested if statement that says if column k = F and 0 then return Female Non Enrolled, if K= F and >0 return Female Enrolled, if K = M and 0 return Male Non Enrolled, if K = M and >0 return Enrolled. I tried this: =IF(AND(K2=F,AN2=0,"Female Non-Enrolled",IF(AND(K2=F,AN2>0,"Female Enrolled",IF(AND(K2=M,AN2=0,"Male Non-Enrolled","Male Enrolled")))))) but there is an error, or perhaps I am doing is wrong. Thanks for your help!
1 Answer
You didn't close your AND statements, just piled up the parens at the end of the formula. Also, your strings should be in "" Try this:
=IF(AND(K2="F",AN2=0),"Female Non-Enrolled",IF(AND(K2="F",AN2>0),"Female Enrolled",IF(AND(K2="M",AN2=0),"Male Non-Enrolled","Male Enrolled")))
2 Comments
Whitney
Thank you, worked like a charm! Signed: A beginner ;)
nwhaught
As a side note, you can investigate what your formulas are doing by selecting "Evaluate Formulas" under the "Formulas" tab. It will show you step by step what is happening when excel tries to evaluate your formulas, including which steps are generating errors. Glad I could help. :-)