<?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 to toggle value (1 or 0) in new column based on change by row in existing column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Formula-to-toggle-value-1-or-0-in-new-column-based-on-change-by/m-p/84942#M38026</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3194"&gt;@Dan_Obermiller&lt;/a&gt;, You are correct, &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5358"&gt;@Mark_Bailey&lt;/a&gt;&amp;nbsp;had a simpler option but both work perfectly!&amp;nbsp; THANKS so much!!!&lt;/P&gt;</description>
    <pubDate>Tue, 04 Dec 2018 19:45:09 GMT</pubDate>
    <dc:creator>WendyLou315</dc:creator>
    <dc:date>2018-12-04T19:45:09Z</dc:date>
    <item>
      <title>Formula to toggle value (1 or 0) in new column based on change by row in existing column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-toggle-value-1-or-0-in-new-column-based-on-change-by/m-p/84743#M37927</link>
      <description>&lt;P&gt;I have a question on creating a formula to do something in JSL that I do very easily in Excel.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I were to have Column A and I want to generate Column B, I would put a zero in B1 then add the formula:&amp;nbsp;&lt;/P&gt;&lt;P&gt;=IF(A2&amp;lt;&amp;gt;A1,IF(B1=0,1,0),B1)&lt;/P&gt;&lt;P&gt;into B2 then copy down the column.&amp;nbsp; Is there a formula to do that in JMP?&amp;nbsp; I have tried Lag() but it doesn't give me the results I'm looking for.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JSL_Question.JPG" style="width: 220px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/14651iFE0B121A3ABB79CA/image-size/large?v=v2&amp;amp;px=999" role="button" title="JSL_Question.JPG" alt="JSL_Question.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 18:42:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-toggle-value-1-or-0-in-new-column-based-on-change-by/m-p/84743#M37927</guid>
      <dc:creator>WendyLou315</dc:creator>
      <dc:date>2018-11-29T18:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to toggle value (1 or 0) in new column based on change by row in existing column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-toggle-value-1-or-0-in-new-column-based-on-change-by/m-p/84746#M37929</link>
      <description>&lt;P&gt;Try this formula:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 350px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/14652i7AA948A228883F46/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 19:05:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-toggle-value-1-or-0-in-new-column-based-on-change-by/m-p/84746#M37929</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2018-11-29T19:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to toggle value (1 or 0) in new column based on change by row in existing column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-toggle-value-1-or-0-in-new-column-based-on-change-by/m-p/84750#M37931</link>
      <description>&lt;P&gt;The formula is exactly the same as what you would put into Excel. The differences are that you need specify the first row in the formula and you need to know exactly what the Excel autofill is doing (which is not always straight-forward).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interactively, it would look like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMP Formula.PNG" style="width: 435px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/14653i04BBCF1940B657EB/image-size/large?v=v2&amp;amp;px=999" role="button" title="JMP Formula.PNG" alt="JMP Formula.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The JSL code would look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(
	Row() == 1, 0,
	:A[Row()] != Lag( :A, 1 ), If( Lag( :B, 1 ) == 0, 1, 0 ),
	Lag( :B, 1 )
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or just use Mark's formula which looks simpler!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 19:25:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-toggle-value-1-or-0-in-new-column-based-on-change-by/m-p/84750#M37931</guid>
      <dc:creator>Dan_Obermiller</dc:creator>
      <dc:date>2018-11-29T19:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to toggle value (1 or 0) in new column based on change by row in existing column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-to-toggle-value-1-or-0-in-new-column-based-on-change-by/m-p/84942#M38026</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3194"&gt;@Dan_Obermiller&lt;/a&gt;, You are correct, &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5358"&gt;@Mark_Bailey&lt;/a&gt;&amp;nbsp;had a simpler option but both work perfectly!&amp;nbsp; THANKS so much!!!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2018 19:45:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-to-toggle-value-1-or-0-in-new-column-based-on-change-by/m-p/84942#M38026</guid>
      <dc:creator>WendyLou315</dc:creator>
      <dc:date>2018-12-04T19:45:09Z</dc:date>
    </item>
  </channel>
</rss>

