<?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: How do I get a JSL script to Sum cells based of other cells. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-get-a-JSL-script-to-Sum-cells-based-of-other-cells/m-p/824303#M100377</link>
    <description>&lt;P&gt;I think this might do what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Var1 = Col Cumulative Sum(
	If( :Column 3 == CurrentWrkWk &amp;amp; :Column 1 == "TIM703",
		:StateHour,
		.
	),
	a1
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Dec 2024 17:15:00 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2024-12-18T17:15:00Z</dc:date>
    <item>
      <title>How do I get a JSL script to Sum cells based of other cells.</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-get-a-JSL-script-to-Sum-cells-based-of-other-cells/m-p/824293#M100376</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I've gotten stuck trying to write a script that will Sum cells based on 2 other cells within the same row.&lt;/P&gt;&lt;P&gt;Im able to select the correct rows with&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; row selection (Select where (:Column 3== CurrentWrkWk &amp;amp; :Column 1== "TIM703"));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Final answer I expect is&lt;/P&gt;&lt;P&gt;The sum should be 3.913.&lt;/P&gt;&lt;P&gt;Ive been reading the scripting index but am lost&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
Clear Globals();
dt = current data table();
CurrentWrkWk = 202450;


a1 == dt &amp;lt;&amp;lt; row selection (Select where (:Column 3== CurrentWrkWk &amp;amp; :Column 1== "TIM703"));
Var1 =Col Cumulative Sum(:StateHour, a1);

show(Var1);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;JMP version 17&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 16:59:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-get-a-JSL-script-to-Sum-cells-based-of-other-cells/m-p/824293#M100376</guid>
      <dc:creator>SampleFerret107</dc:creator>
      <dc:date>2024-12-18T16:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a JSL script to Sum cells based of other cells.</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-get-a-JSL-script-to-Sum-cells-based-of-other-cells/m-p/824303#M100377</link>
      <description>&lt;P&gt;I think this might do what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Var1 = Col Cumulative Sum(
	If( :Column 3 == CurrentWrkWk &amp;amp; :Column 1 == "TIM703",
		:StateHour,
		.
	),
	a1
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Dec 2024 17:15:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-get-a-JSL-script-to-Sum-cells-based-of-other-cells/m-p/824303#M100377</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-12-18T17:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a JSL script to Sum cells based of other cells.</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-get-a-JSL-script-to-Sum-cells-based-of-other-cells/m-p/824304#M100378</link>
      <description>&lt;P&gt;For sum you can also use data table subscripting&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open("$SAMPLE_DATA/Big Class.jmp");

age_of_interest = 12;
sex_of_interest = "F";

rows_of_interest = dt &amp;lt;&amp;lt; Get Rows Where(:age == age_of_interest &amp;amp; :sex == sex_of_interest);

res = Sum(dt[rows_of_interest, "height"]);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 17:27:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-get-a-JSL-script-to-Sum-cells-based-of-other-cells/m-p/824304#M100378</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-12-18T17:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get a JSL script to Sum cells based of other cells.</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-get-a-JSL-script-to-Sum-cells-based-of-other-cells/m-p/824315#M100380</link>
      <description>&lt;P&gt;Hi Jthi,&lt;/P&gt;&lt;P&gt;Thank you this has worked&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 18:05:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-get-a-JSL-script-to-Sum-cells-based-of-other-cells/m-p/824315#M100380</guid>
      <dc:creator>SampleFerret107</dc:creator>
      <dc:date>2024-12-18T18:05:28Z</dc:date>
    </item>
  </channel>
</rss>

