cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • Use JMP Clinical with CDISC-compliant data. Review studies, ID safety and efficacy signals & communicate findings with interactive graphics. Register to see how. Aug. 27, 2 pm US ET.

Discussions

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

Formula to toggle value (1 or 0) in new column based on change by row in existing column

I have a question on creating a formula to do something in JSL that I do very easily in Excel. 

 

If I were to have Column A and I want to generate Column B, I would put a zero in B1 then add the formula: 

=IF(A2<>A1,IF(B1=0,1,0),B1)

into B2 then copy down the column.  Is there a formula to do that in JMP?  I have tried Lag() but it doesn't give me the results I'm looking for.

JSL_Question.JPGJSL_Question.JPG

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Formula to toggle value (1 or 0) in new column based on change by row in existing column

Try this formula:

 

Capture.PNGCapture.PNG

View solution in original post

Re: Formula to toggle value (1 or 0) in new column based on change by row in existing column

The formula is exactly the same as what you would put into Excel. The differences are that you need specify the first row in the formula and you need to know exactly what the Excel autofill is doing (which is not always straight-forward).

 

Interactively, it would look like this:

JMP Formula.PNGJMP Formula.PNG

 

The JSL code would look like this:

If(
	Row() == 1, 0,
	:A[Row()] != Lag( :A, 1 ), If( Lag( :B, 1 ) == 0, 1, 0 ),
	Lag( :B, 1 )
)

 

 

Or just use Mark's formula which looks simpler!

Dan Obermiller

View solution in original post

3 REPLIES 3

Re: Formula to toggle value (1 or 0) in new column based on change by row in existing column

Try this formula:

 

Capture.PNGCapture.PNG

Re: Formula to toggle value (1 or 0) in new column based on change by row in existing column

The formula is exactly the same as what you would put into Excel. The differences are that you need specify the first row in the formula and you need to know exactly what the Excel autofill is doing (which is not always straight-forward).

 

Interactively, it would look like this:

JMP Formula.PNGJMP Formula.PNG

 

The JSL code would look like this:

If(
	Row() == 1, 0,
	:A[Row()] != Lag( :A, 1 ), If( Lag( :B, 1 ) == 0, 1, 0 ),
	Lag( :B, 1 )
)

 

 

Or just use Mark's formula which looks simpler!

Dan Obermiller
WendyLou315
Level III

Re: Formula to toggle value (1 or 0) in new column based on change by row in existing column

@Dan_Obermiller, You are correct, @Mark_Bailey had a simpler option but both work perfectly!  THANKS so much!!!

Recommended Articles