<?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: Writing Excel formula in JSL script (Formula in attached excel file) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Writing-Excel-formula-in-JSL-script-Formula-in-attached-excel/m-p/535349#M75770</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2610"&gt;@vince_faller&lt;/a&gt;&amp;nbsp;provides a solution that works for your data table in the form after the table has been sorted.&amp;nbsp; I am not sure what it takes to order your data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below, is a formula that was developed using the imported Excel file and making no modification to the file once it is imported into JMP.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1660871230986.png" style="width: 942px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44860i5BA886600FECA435/image-dimensions/942x274?v=v2" width="942" height="274" role="button" title="txnelson_0-1660871230986.png" alt="txnelson_0-1660871230986.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1 | :ATT1 != Lag( :ATT1 ),
	currATT1 = :ATT1;
	currFreq = :FREQUENCY;
	currRow = Row();
	If( :ATT1 == 0,
		theRow = 0,
		theRow = (Current Data Table() &amp;lt;&amp;lt; get rows where(
			Row() &amp;gt; currRow &amp;amp; :ATT1 == currATT1 - 1 &amp;amp; :FREQUENCY == currFreq
		))[1] - Row()
	);
);
:RESULT - :RESULT[Row() + theRow];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Each time the value of ATT! changes, the formula looks ahead to find the next row where the FREQUENCY is the same as the current FREQUENCY and the ATT! is 1 less than the current value of ATT1 and finds the number of rows between the current row, and the look ahead row.&amp;nbsp; It uses that offset value from that point on, until the value of ATT1 changes again.&lt;/P&gt;
&lt;P&gt;Attached is the imported Excel file I used.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2022 01:17:42 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-08-19T01:17:42Z</dc:date>
    <item>
      <title>Writing Excel formula in JSL script (Formula in attached excel file)</title>
      <link>https://community.jmp.com/t5/Discussions/Writing-Excel-formula-in-JSL-script-Formula-in-attached-excel/m-p/535315#M75767</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to replicate formulas that are currently in the attached excel sheet.&lt;/P&gt;&lt;P&gt;Where, DSA_Step_Size(dB) = ABS(of delta of :RESULT&amp;nbsp;rows when ATT1 values are decreasing for the same :FREQUENCY value).&lt;/P&gt;&lt;P&gt;The formula is in excel sheet if my explanation is confusing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;DSA Range(dB) = ABS(of delta of :RESULT rows when ATT1=63 and ATT1=0 for each :FREQUENCY).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use for loops in the formula.. so far not getting the result I want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;n = 63;&lt;BR /&gt;For( i = 1, i &amp;lt;= n, i++,&lt;BR /&gt;:RESULT[i] - :RESULT[i + 3]&lt;BR /&gt;);&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:53:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Writing-Excel-formula-in-JSL-script-Formula-in-attached-excel/m-p/535315#M75767</guid>
      <dc:creator>LearningJMP</dc:creator>
      <dc:date>2023-06-10T23:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Excel formula in JSL script (Formula in attached excel file)</title>
      <link>https://community.jmp.com/t5/Discussions/Writing-Excel-formula-in-JSL-script-Formula-in-attached-excel/m-p/535333#M75768</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;if(row() &amp;lt;= 63, :RESULT[Row()] - :RESULT[Row() + 3])&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 23:02:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Writing-Excel-formula-in-JSL-script-Formula-in-attached-excel/m-p/535333#M75768</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2022-08-18T23:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Excel formula in JSL script (Formula in attached excel file)</title>
      <link>https://community.jmp.com/t5/Discussions/Writing-Excel-formula-in-JSL-script-Formula-in-attached-excel/m-p/535349#M75770</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2610"&gt;@vince_faller&lt;/a&gt;&amp;nbsp;provides a solution that works for your data table in the form after the table has been sorted.&amp;nbsp; I am not sure what it takes to order your data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below, is a formula that was developed using the imported Excel file and making no modification to the file once it is imported into JMP.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1660871230986.png" style="width: 942px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44860i5BA886600FECA435/image-dimensions/942x274?v=v2" width="942" height="274" role="button" title="txnelson_0-1660871230986.png" alt="txnelson_0-1660871230986.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1 | :ATT1 != Lag( :ATT1 ),
	currATT1 = :ATT1;
	currFreq = :FREQUENCY;
	currRow = Row();
	If( :ATT1 == 0,
		theRow = 0,
		theRow = (Current Data Table() &amp;lt;&amp;lt; get rows where(
			Row() &amp;gt; currRow &amp;amp; :ATT1 == currATT1 - 1 &amp;amp; :FREQUENCY == currFreq
		))[1] - Row()
	);
);
:RESULT - :RESULT[Row() + theRow];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Each time the value of ATT! changes, the formula looks ahead to find the next row where the FREQUENCY is the same as the current FREQUENCY and the ATT! is 1 less than the current value of ATT1 and finds the number of rows between the current row, and the look ahead row.&amp;nbsp; It uses that offset value from that point on, until the value of ATT1 changes again.&lt;/P&gt;
&lt;P&gt;Attached is the imported Excel file I used.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 01:17:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Writing-Excel-formula-in-JSL-script-Formula-in-attached-excel/m-p/535349#M75770</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-08-19T01:17:42Z</dc:date>
    </item>
  </channel>
</rss>

