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

Counting the number of variable columns that have non-zero values

I have a table of formulations.  The amount of each of 60 possible ingredients are listed in columns.  Most of the formulations contain only 5-10 ingredients with the ingredient amount of all other columns being zero.

 

I would like to create a formulation column (without scripting) to count the number of non-zero ingredients.

 

The way I was thinking to do this is to sum conditional statements for each ingredient.  This shows the first 4 ingredients:

kpgallagher_ppg_0-1588779368026.png

 

Is there a quicker/easier way to do this without having to create a string of 60 if statements?

 

Kevin Gallagher
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Counting the number of variable columns that have non-zero values

You can shorten the code up to

sum( :T400>0,:T402>0,:T404>0,:T405>0)
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Counting the number of variable columns that have non-zero values

You can shorten the code up to

sum( :T400>0,:T402>0,:T404>0,:T405>0)
Jim

Recommended Articles