cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
dadawasozo
Level IV

counting total item in each cell that contain different pattern

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.