<?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 Formula to count number of selected rows that meet a certain criteria in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/109169#M39624</link>
    <description>&lt;P&gt;Is it possible to create a column formula in JMP&amp;nbsp;that counts the number of *selected* rows that meet a certain criteria?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Excel can't do this, but if it did the formula&amp;nbsp;might look something like this:&amp;nbsp; =countif(and(isSelected(),a1:a20=$c$1,b1:b20="red"))&lt;/P&gt;</description>
    <pubDate>Thu, 07 Feb 2019 20:58:09 GMT</pubDate>
    <dc:creator>BHarris</dc:creator>
    <dc:date>2019-02-07T20:58:09Z</dc:date>
    <item>
      <title>Formula to count number of selected rows that meet a certain criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/109169#M39624</link>
      <description>&lt;P&gt;Is it possible to create a column formula in JMP&amp;nbsp;that counts the number of *selected* rows that meet a certain criteria?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Excel can't do this, but if it did the formula&amp;nbsp;might look something like this:&amp;nbsp; =countif(and(isSelected(),a1:a20=$c$1,b1:b20="red"))&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 20:58:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/109169#M39624</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2019-02-07T20:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to count number of selected rows that meet a certain criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/109220#M39625</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/12313"&gt;@BHarris&lt;/a&gt;&amp;nbsp; ,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; May I ask why you are thinking about a column formula ? If you look at the example shown here, there are 4 rows selected in this data table. No matter where you check in your column formula, it will say "4" unless you want to do a cumulative sum of selected rows&amp;nbsp; so it would go gradually from 1 to n.&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Here is a very similar post that could address your question if you are looking to use scripting&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Count-Rows-Selected-amp-quickly-summarize-categories-under-one/td-p/41932" target="_blank" rel="noopener"&gt;https://community.jmp.com/t5/Discussions/Count-Rows-Selected-amp-quickly-summarize-categories-under-one/td-p/41932&lt;/A&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 537px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/15452i975C4749890E0D71/image-dimensions/537x448?v=v2" width="537" height="448" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 22:09:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/109220#M39625</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2019-02-07T22:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to count number of selected rows that meet a certain criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/109422#M39626</link>
      <description>&lt;P&gt;Here is one formula that will work, or it can also be used as an element of a script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

selRows = dt &amp;lt;&amp;lt; get selected rows;
If( N Rows( selRows ) &amp;gt; 0,
	count = 0;
	For( i = 1, i &amp;lt;= N Rows( selRows ), i++,
		count = count + (:age[selRows[i]] == 12 &amp;amp; :sex[selRows[i]] == "F")
	);
,
	count = 0
);
count;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Feb 2019 22:26:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/109422#M39626</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-02-07T22:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to count number of selected rows that meet a certain criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/109856#M39736</link>
      <description>&lt;P&gt;I'm really trying to do calculations on the selection -- I've got time-based data, e.g., noise, heat, and vibration vs. time for a number of tests. &amp;nbsp;Sometimes I'll see odd clusters in the data in Graph Builder, which I'll select, then I want to know how long that condition lasted, so I'd like to have another Graph Builder window that can plot count of selected points vs. test id.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a better way to do this?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 16:10:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/109856#M39736</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2019-02-11T16:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to count number of selected rows that meet a certain criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/119518#M40002</link>
      <description>&lt;P&gt;I pasted that text in as a formula for the column, but the column just ended up all dots. &amp;nbsp;I also tried this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;N Row(Current Data Table() &amp;lt;&amp;lt; GetSelected())&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;... which resulted in the same thing. &amp;nbsp;I expected the column to be the number of selected rows, e.g., with 3 rows selected, I expected to see "3" in every cell in the column.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 23:32:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/119518#M40002</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2019-02-20T23:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to count number of selected rows that meet a certain criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/126755#M40011</link>
      <description>&lt;P&gt;Attached is a copy of the JMP Sample Data Table Big Class.&amp;nbsp; I have added in the formula in question for the new column called "Column 6".&amp;nbsp; I am running JMP 14.2 and the formula works for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 04:20:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/126755#M40011</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-02-21T04:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to count number of selected rows that meet a certain criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/126934#M40012</link>
      <description>&lt;P&gt;I'm running 14.0.0, and that column just shows up as all 1s, regardless of what I select. &amp;nbsp;Is there a recalculate button somewhere?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Out of curiosity, what was wrong with my formula? &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-jsl"&gt;&lt;CODE class="  language-jsl"&gt;&lt;SPAN class="token function"&gt;N Row&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Current Data Table&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token messages"&gt; GetSelected&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Makes sense to me, but it doesn't work and doesn't seem to offer any meaningful errors.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 04:28:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/126934#M40012</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2019-02-21T04:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to count number of selected rows that meet a certain criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/130009#M40014</link>
      <description>&lt;P&gt;Click on the red triangle next to the name of the data table in the table panel, and select "Rerun Formulas".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need to have the formula automatically rerun whenever a change in selections is made, then a simple Row State Handler can be scripted.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();

f = function( {a}, dt &amp;lt;&amp;lt; rerun formulas(); );
rs = dt &amp;lt;&amp;lt; make row state handler(f);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Feb 2019 06:36:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/130009#M40014</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-02-21T06:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to count number of selected rows that meet a certain criteria</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/130528#M40015</link>
      <description>&lt;P&gt;Thanks, Jim! &amp;nbsp;It worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Slightly rephrased, for those who need to hear things different ways, here's how you have a column that counts the number of selected rows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Make a new column with formula: N Rows( Current Data Table() &amp;lt;&amp;lt; get selected rows )&lt;OL&gt;&lt;LI&gt;Note, this formula won't automatically update when the selection changes, which is why we do step #2...&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: inherit;"&gt;Make a new script (in red triangle menu in top left of data table) with:&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
f = Function( {a},
dt &amp;lt;&amp;lt; rerun formulas()
);
rs = dt &amp;lt;&amp;lt; make row state handler( f );&lt;/CODE&gt;&lt;/PRE&gt;... which basically says, whenever the row states change, run function "f", which takes "a" as an argument (which gets ignored), and tells dt (the current data table) to re-run its formulas. &amp;nbsp;Then run this script once.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Jim's answer shows how to extend this to only count selected rows that meet some other criteria, which was part of the original question.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thx again!&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 06:59:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-count-number-of-selected-rows-that-meet-a-certain/m-p/130528#M40015</guid>
      <dc:creator>BHarris</dc:creator>
      <dc:date>2019-02-21T06:59:58Z</dc:date>
    </item>
  </channel>
</rss>

