cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar

Countif equivalent?

I am trying to find a JMP formula function equivalent to Excel’s Countif function, that points to a column and returns the number of rows that are the same as the value in the current row, as you would get if you did a Summary on that row.

 

In other words, if I have a 1000-line table, and column Color is set to "Purple" in 27 rows, I want a formula for a new row that returns 27 for those rows (and the applicable value for the other rows)

 

(I’m sure this is in here, but **bleep** if I can find it)

 

JMP 17, macOS

11 REPLIES 11
Craige_Hales
Super User

Re: Countif equivalent?

Close, I think. I was never in that C++ code, but I believe on the very first call (typically for row 1) it preprocesses all the rows to cache all the possible by-value answers. Then all subsequent rows are answered from that by-value cache. (Without the cache it would be an order(N^2) time for N rows, with the cache just order(N) - linear time.)

 

Craige
hogi
Level XI

Re: Countif equivalent?

@Audrey_Shull If you plan to add @jthi 's example in a future version of Scripting Index or Online Help , please also add a paragraph about the magic of
https://community.jmp.com/t5/Discussions/JMP-equivalent-of-Excel-s-COUNTIF-function/m-p/783500/highl...