<?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 Re: Formula Column for &amp;quot;N&amp;quot; Instances of Column 1 per value of Column 2 in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264952#M51615</link>
    <description>OK......so everybody use Jeff's answer......it is the correct one...…..I don't know what I was thinking with my response:-)&lt;BR /&gt;</description>
    <pubDate>Wed, 06 May 2020 21:36:30 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2020-05-06T21:36:30Z</dc:date>
    <item>
      <title>Formula Column for "N" Instances of Column 1 per value of Column 2</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264919#M51606</link>
      <description>&lt;P&gt;I apologize that this type of question has probably already been asked in the Discussions, but I cannot find a solution that works for the application I need. The search terms of "Sum" "Count" etc. are too generic and make it difficult to find a solution precisely for what I am trying to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a column with a formula of how many instances of "Column 1" occur per a given value of "Column 2"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tabulate function can do this very easily by simply stating "N" for a given "Week" column, but I need it to be a Column Formula for the application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created an example table with Apples, Oranges, and Bananas to demonstrate. I need a formula for the third column "Instances of this Fruit this Week" to list how many instances there are of "Fruit of the Day" for a given "Week". For example, the "Instances of Fruit per Week" column would list [5,2,5,5,5,5,2...] Because Apple occurs 5 times in Week=1, and Banana occurs 2 times in Week=1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the continued support with this great software, JMP community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;New Table( "Fruit Table",&lt;BR /&gt;Add Rows( 28 ),&lt;BR /&gt;New Column( "Fruit of the Day",&lt;BR /&gt;Character( 8 ),&lt;BR /&gt;"Nominal",&lt;BR /&gt;Set Values(&lt;BR /&gt;{"Apple", "Banana", "Apple", "Apple", "Apple", "Apple", "Banana",&lt;BR /&gt;"Orange", "Apple", "Banana", "Apple", "Banana", "Apple", "Apple",&lt;BR /&gt;"Apple", "Banana", "Apple", "Apple", "Apple", "Apple", "Banana", "Apple",&lt;BR /&gt;"Banana", "Apple", "Apple", "Apple", "Apple", "Banana"}&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;New Column( "Week",&lt;BR /&gt;Numeric,&lt;BR /&gt;"Nominal",&lt;BR /&gt;Format( "Best", 12 ),&lt;BR /&gt;Set Values(&lt;BR /&gt;[1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,&lt;BR /&gt;4, 4, 4, 4]&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;New Column( "Instances of this Fruit this Week",&lt;BR /&gt;Numeric,&lt;BR /&gt;"Continuous",&lt;BR /&gt;Format( "Best", 12 ),&lt;BR /&gt;Set Values(&lt;BR /&gt;[., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., .,&lt;BR /&gt;., ., ., .]&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 20:01:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264919#M51606</guid>
      <dc:creator>cheese_stats</dc:creator>
      <dc:date>2020-05-06T20:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Column for "N" Instances of Column 1 per value of Column 2</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264946#M51612</link>
      <description>&lt;P&gt;This formula will work, but see&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6878"&gt;@Jeff_Perkinson&lt;/a&gt; response below for the better answer&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;curFruit = :Fruit of the Day;
N Rows( Current Data Table() &amp;lt;&amp;lt; get rows where( :Fruit of the Day == curFruit ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 21:37:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264946#M51612</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-06T21:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Column for "N" Instances of Column 1 per value of Column 2</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264951#M51614</link>
      <description>&lt;P&gt;Here's a formula that will work. The &lt;A href="https://www.jmp.com/support/help/en/15.1/#page/jmp/statistical-functions.shtml#ww129519" target="_self"&gt;Col Number() function&lt;/A&gt; counts the number of non-missing rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Number( :Week, :Fruit of the Day, :Week )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2020-05-06_17-23-20.487.png" style="width: 543px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/23789iF4738D72C92E260A/image-dimensions/543x374?v=v2" width="543" height="374" role="button" title="2020-05-06_17-23-20.487.png" alt="2020-05-06_17-23-20.487.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 21:27:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264951#M51614</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2020-05-06T21:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Column for "N" Instances of Column 1 per value of Column 2</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264952#M51615</link>
      <description>OK......so everybody use Jeff's answer......it is the correct one...…..I don't know what I was thinking with my response:-)&lt;BR /&gt;</description>
      <pubDate>Wed, 06 May 2020 21:36:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264952#M51615</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-06T21:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Formula Column for "N" Instances of Column 1 per value of Column 2</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264953#M51616</link>
      <description>&lt;P&gt;Yes, this works perfectly. I have created a script for the new column using the formula:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Number()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks very much, everyone&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6878"&gt;@Jeff_Perkinson&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 21:44:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-Column-for-quot-N-quot-Instances-of-Column-1-per-value/m-p/264953#M51616</guid>
      <dc:creator>cheese_stats</dc:creator>
      <dc:date>2020-05-06T21:44:34Z</dc:date>
    </item>
  </channel>
</rss>

