cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
eldad_galili
Level III

Grouping Data

Hi,

 

I would like to group data as the attached image.

whenever there is a "No" the result will be a 0.

When ever there is a "Yes" the result will be a running number (1,2,3...) for each group.

 

How do I implement this in a formula (or script?).

 

Thank you very much.

 

 

 

Group.JPG

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Grouping Data

Copy this expression and paste it into the Formula Editor for the Grouping column:

 

If(
	Row() == 1,
		temp = :Y == "Yes";
		temp;,
	:Y == "Yes" & Lag( :Y ) == "No",
		temp++;
		temp;,
	:Y == "Yes", temp,
	0
)

 

Change the name of Y to the original data column.

View solution in original post

2 REPLIES 2

Re: Grouping Data

Copy this expression and paste it into the Formula Editor for the Grouping column:

 

If(
	Row() == 1,
		temp = :Y == "Yes";
		temp;,
	:Y == "Yes" & Lag( :Y ) == "No",
		temp++;
		temp;,
	:Y == "Yes", temp,
	0
)

 

Change the name of Y to the original data column.

eldad_galili
Level III

Re: Grouping Data

Thank you very much