cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
NathanFisk
Level III

Can an IF formula use boolean character filtering?

Hello all,

 

I'm trying to run a column creation formula in JMP and I can't figure out how to get the system to perform the function I'm wanting.

Specifically, there is a column of Serial Numbers of six characters.  The first character is always an "S" (for serial number).  The next 5 characters will always be a sequence of five numbers that begins either with a 7, a 5, or a 0 (representing three different product generations).  

What I'd like to do is make a formula that does an "IF" function that says "IF (VAR) = S7* THEN "3"" ... which would look at the serial number column and see if it started with an S7 then it would set the new column's value to 3 (3rd generation) and so on with generation 2 and generation 1.   

Is this possible with the JMP formula logic?  There's a ton of options but its a bit complicated figuring them all out.

3 REPLIES 3
jthi
Super User

Re: Can an IF formula use boolean character filtering?

Many options for this, if-elseif most simple one

If(
	Starts With(:col, "S7"), "3"
	, Starts With(:col, "S3"), "1"
	// and so on
);

you can also chain the if-statements if necessary or use IsMissing(Regex()) for more complicated pattern comparisons. If you can provide example data we can provide better examples (add wanted result column if possible).

-Jarmo
hogi
Level XII

Re: Can an IF formula use boolean character filtering?

another option: Match

New Column( "generation",
	Formula( Match( Word( 2, :Column 1, "" ),
"3", 1, 
"5", 2, 
"7", 3 ) )
)
NashTaylor
Level I

Re: Can an IF formula use boolean character filtering?

Thank you.

Boolean filtering can be a game-changer in data processing, simplifying conditional logic. Similarly, structured thinking is essential in writing creative essays. Coming up with fresh, engaging topics can be challenging, but GradesFixer https://gradesfixer.com/blog/creative-essay-topics-inspiring-ideas-for-your-next-masterpiece/ provides a collection of unique creative essay ideas to inspire original work. Whether structuring a dataset or an argument in writing, a logical approach leads to clarity and impact.

Recommended Articles