cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

counting total item in each cell that contain different pattern

dadawasozo
Level IV

Hi,
I want to get the total count of the item in the cell under setting columns. Can someone give me suggestion how I can code it so it will take the value under :setting column and count the total number like what shown under :Total Items. Many Thanks.

dadawasozo_0-1649977351362.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User


Re: counting total item in each cell that contain different pattern

Here is the formula for the column Total Items, that I came up with.

count = 0;
i = 1;
While( Word( i, :setting, "," ) != "",
	theWord = Word( i, :setting, "," );
	If( Contains( theWord, "-" ) | Contains( theWord, ":" ),
		Show( Row(), theWord );
		count = ((count + Num( Word( 2, theWord, "-:" ) )) - Num( Word( 1, theWord, "-:" ) )) + 1;
	,
		count
		++);
	i++;
);
count;

 

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User


Re: counting total item in each cell that contain different pattern

Here is the formula for the column Total Items, that I came up with.

count = 0;
i = 1;
While( Word( i, :setting, "," ) != "",
	theWord = Word( i, :setting, "," );
	If( Contains( theWord, "-" ) | Contains( theWord, ":" ),
		Show( Row(), theWord );
		count = ((count + Num( Word( 2, theWord, "-:" ) )) - Num( Word( 1, theWord, "-:" ) )) + 1;
	,
		count
		++);
	i++;
);
count;

 

Jim
dadawasozo
Level IV

Re: counting total item in each cell that contain different pattern

This is amazing! I was only able to do one type str count. I learn new thing. Thanks a lot.