Link to home
Start Free TrialLog in
Avatar of gdunn59
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 Ryan Chong
Ryan Chong
Flag of Singapore image

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

ASKER

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".
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gdunn59

ASKER

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!