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
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

Recommended Articles