cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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