Forum Discussion
Kathy_CPDdesign
Feb 28, 2024Copper Contributor
Problem with Nested IF AND OR formulas
I want to compare data in two cells and return a result based on the following rules:
IF A2 = "wrong" AND A3 = "correct", return "improved"
IF A2 = "correct" AND A3 = "correct", return "reinforced"
IF A2 = "correct" OR "wrong" AND A3 = "wrong", return "no impact"
no result, return "missing data"
I tried the following formula but am getting #NAME? error. Any thoughts?
=IF(AND(A2=”wrong”,A3=”correct”),”improved”,IF(AND(A2=”correct”,A3=”correct”),”reinforced”,IF(AND(A3=”wrong”,OR(A2=”wrong”,”A2=”correct”),”no impact”,”missing data”)))
Kathy_CPDdesign The #NAME? errors you're getting is likely due to your use of the right double quotation marks ” (ASCII code 148) as opposed to the correct double quotes " (ASCII code 34) accepted in Excel formulas. Try copying and pasting the modified formula below and see if it works as expected:
=IF(AND(A2="wrong",A3="correct"),"improved",IF(AND(A2="correct",A3="correct"),"reinforced",IF(AND(A3="wrong",OR(A2="wrong",A2="correct")),"no impact","missing data")))
- djclementsBronze Contributor
Kathy_CPDdesign The #NAME? errors you're getting is likely due to your use of the right double quotation marks ” (ASCII code 148) as opposed to the correct double quotes " (ASCII code 34) accepted in Excel formulas. Try copying and pasting the modified formula below and see if it works as expected:
=IF(AND(A2="wrong",A3="correct"),"improved",IF(AND(A2="correct",A3="correct"),"reinforced",IF(AND(A3="wrong",OR(A2="wrong",A2="correct")),"no impact","missing data")))
- Kathy_CPDdesignCopper ContributorThank you! Works perfectly now. Appreciate your help
- djclementsBronze ContributorYou're welcome 🙂