Avatar of gdunn59
 asked on

IF/OR Statement in my Excel VBA Code not working as expected

Using an IF/OR statement in excel vba but it does not work if I do more than one IF statement.  What am I doing wrong?

I would like to actually add 2 or 3 more IF statements.

Here is the code with the one IF/OR statement where it works:

ActiveCell.FormulaR1C1 = "=IF([@[PME_PROGRAM]]=""IDE"",""YES"",""NO"")"

Open in new window

Here is the code with more than one IF statement where it is not working:

ActiveCell.FormulaR1C1 = "=IF(OR([@[PME_PROGRAM]]=""IDE"",""YES"",""NO"",IF([@PME_PROGRAM]]=""PDE"",""YES"",""NO""))"

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon
Ryan Chong

so... what's the criteria to return Yes or No?

Ryan Chong,

If PME_Program field is equal to "IDE" or  "SDE" or "PDE" then put "Yes" in the PME_Completed field, otherwise put "No".
Ryan Chong

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Ryan Chong,

ActiveCell.FormulaR1C1 = "=IF(OR([@[PME_PROGRAM]]=""IDE"",[@[PME_PROGRAM]]=""PDE""),""YES"",""NO"")"

This appears to be working.  I want to do some more testing hopefully tomorrow before I close this out.

Thank you!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes