cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
BHarris
Level VI

JMP equivalent of Excel's COUNTIF function

I'm trying to mimic this Excel-type behavior:

 

 AB
1

failureType

numFailuresThisType
2

f1

=countif($a$2:$a$999,a2)
3f2=countif($a$2:$a$999,a3)
4f1=countif($a$2:$a$999,a4)
5f1=countif($a$2:$a$999,a5)
6f2=countif($a$2:$a$999,a6)
.........

 

... in JMP.  Is this possible as a column formula?

 

I've tried "Col Sum( :failureType == :failureType[ Row() ] )" but that doesn't work and I don't understand why.  Sometimes ":ColumnName" returns a single value, and other times it returns the entire column's-worth of entries and auto-loops over them.  Is there a way to tell which it will do, perhaps from the Scripting Index?

14 REPLIES 14
hogi
Level XII

Re: JMP equivalent of Excel's COUNTIF function

@BHarris 

 


@BHarris wrote:

sometimes in column formulas, JMP will iterate over the rows in a column when entered as ":columnName"


Can you give an example?

BHarris
Level VI

Re: JMP equivalent of Excel's COUNTIF function

Sure, open up BigClass.jmp and add a column with this formula:

 

Col Sum( :height * :weight, :sex )

jthi
Super User

Re: JMP equivalent of Excel's COUNTIF function

Even though it looks like it does work, I wouldn't use it (I think it should be fine if it required you to have :failureType as byvar). I would think that it is some sort of unintended behavior (even more than using 1 which shouldn't be allowed either according to JMP support, but let us hope that JMP never breaks that
Make using formula expressions in Set Each Value and using expressions as first argument in Col stat... ).

 

You could report it to JMP Support and try to see if they can give technical explanation about why it works like it does. You can also try using other comparisons in similar manner

jthi_1-1724352914250.png

 

 

-Jarmo
jthi
Super User

Re: JMP equivalent of Excel's COUNTIF function

Other option is Col Number()

Col Number(:FailureType, :FailureType)
-Jarmo

Re: JMP equivalent of Excel's COUNTIF function

These replies directly answered your question about a function that works like Excel. You can also use Table > Summary, Analyze > Tabulate, and Graph > Graph Builder for summaries without using a formula column if that is where you are headed.