cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
EH1
EH1
Level III

AND/OR statements in Formula Editor

Hi All,

 

I was hoping someone could help me with a formula containing AND/OR statements.  I have written a formula in "Column 5" based on the results of 3 other columns: Run F, Run M, and Run S.  The portions of the formula that only contain IF/THEN statements produce the desired results.  However, the portions of the formula that also contain AND/OR statements do not work (non-working portions of the formula are circled in RED in the attached screen shot).  The JMP file is also attached below.  Can anyone please help on what I am doing wrong?

 

Thank you!

Erica

 

Screen Shot 2021-07-12 at 10.06.06 AM.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: AND/OR statements in Formula Editor

Try this form and see if the logic works correctly

If(
	:Run F == 1 | :Run M == 1, "Leave",
	:Run F == 2, "Keep",
	:Run F == 3, "Upscale",
	(:Run F == 4 | :Run F == 5) & (:Run S == 1 | :Run S == 2), "Fix",
	(:Run F == 4 | :Run F == 5) & (:Run S == 3 | :Run S == 4), "Encode",
	:Run M == 2, "Upscale",
	:Run M == 3 & (:Run S == 1 | :Run S == 2), "Fix",
	:Run M == 3 & (:Run S == 3 | :Run S == 4), "Encode"
)
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: AND/OR statements in Formula Editor

Try this form and see if the logic works correctly

If(
	:Run F == 1 | :Run M == 1, "Leave",
	:Run F == 2, "Keep",
	:Run F == 3, "Upscale",
	(:Run F == 4 | :Run F == 5) & (:Run S == 1 | :Run S == 2), "Fix",
	(:Run F == 4 | :Run F == 5) & (:Run S == 3 | :Run S == 4), "Encode",
	:Run M == 2, "Upscale",
	:Run M == 3 & (:Run S == 1 | :Run S == 2), "Fix",
	:Run M == 3 & (:Run S == 3 | :Run S == 4), "Encode"
)
Jim
EH1
EH1
Level III

Re: AND/OR statements in Formula Editor

That works perfectly!!  Thank you so much, Txnelson!!  I greatly appreciate your help!!

Recommended Articles