<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Count number of unique items in column that meet some criteria in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Count-number-of-unique-items-in-column-that-meet-some-criteria/m-p/961666#M110239</link>
    <description>&lt;P&gt;Suppose in "Big Class" I'd like a formula that counts the number of unique names of people at or less than the height of the person in the current row.&amp;nbsp; How can I do that?&lt;/P&gt;
&lt;P&gt;I have this:&lt;/P&gt;
&lt;P&gt;thisHeight = :height;&lt;BR /&gt;Col N Unique( :name, :height &amp;lt;= thisHeight );&lt;/P&gt;
&lt;P&gt;I realize the second parameter is the grouping parameter, and it's more intuitive to try to constrain what gets passed into the first parameter, but I haven't had any luck with anything I've tried to this point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jul 2026 22:48:49 GMT</pubDate>
    <dc:creator>BHarris</dc:creator>
    <dc:date>2026-07-27T22:48:49Z</dc:date>
    <item>
      <title>Count number of unique items in column that meet some criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Count-number-of-unique-items-in-column-that-meet-some-criteria/m-p/961666#M110239</link>
      <description>&lt;P&gt;Suppose in "Big Class" I'd like a formula that counts the number of unique names of people at or less than the height of the person in the current row.&amp;nbsp; How can I do that?&lt;/P&gt;
&lt;P&gt;I have this:&lt;/P&gt;
&lt;P&gt;thisHeight = :height;&lt;BR /&gt;Col N Unique( :name, :height &amp;lt;= thisHeight );&lt;/P&gt;
&lt;P&gt;I realize the second parameter is the grouping parameter, and it's more intuitive to try to constrain what gets passed into the first parameter, but I haven't had any luck with anything I've tried to this point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2026 22:48:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Count-number-of-unique-items-in-column-that-meet-some-criteria/m-p/961666#M110239</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2026-07-27T22:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of unique items in column that meet some criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Count-number-of-unique-items-in-column-that-meet-some-criteria/m-p/961765#M110243</link>
      <description>&lt;P&gt;The closest built in function that comes to mind is &lt;STRONG&gt;Col Rank( :height, &amp;lt;&amp;lt;tie( "maximum" ) )&lt;/STRONG&gt;. The problem is: this counts the total number of &lt;U&gt;rows&lt;/U&gt; at or below thisHeight, not the number of &lt;U&gt;unique names&lt;/U&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Instead, you could try a custom formula, like this:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;thisHeight = :height; //store the current height value

// Build an associative array to collect unique names at or below thisHeight
aa = Associative Array();
For( i = 1, i &amp;lt;= N Rows(), i++,
    If( Column("height")[i] &amp;lt;= thisHeight, 
        aa[Column("name")[i]] = 1  // This only adds to the Associative Array if this is a new, unique name
    )
);

// The number of Items that have been added to the array = number of unique names
N Items( aa )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2026 10:41:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Count-number-of-unique-items-in-column-that-meet-some-criteria/m-p/961765#M110243</guid>
      <dc:creator>christian-z</dc:creator>
      <dc:date>2026-07-28T10:41:40Z</dc:date>
    </item>
  </channel>
</rss>

