<?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 use an if statement and a by variable correctly in a column mean formula? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-use-an-if-statement-and-a-by-variable-correctly-in-a/m-p/40281#M23585</link>
    <description>Thanks Craig. This worked.&lt;BR /&gt;</description>
    <pubDate>Mon, 12 Jun 2017 15:51:40 GMT</pubDate>
    <dc:creator>rperkins</dc:creator>
    <dc:date>2017-06-12T15:51:40Z</dc:date>
    <item>
      <title>How do I use an if statement and a by variable correctly in a column mean formula?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-use-an-if-statement-and-a-by-variable-correctly-in-a/m-p/40229#M23541</link>
      <description>&lt;P&gt;I'm trying to use the columne mean formula to show the Time 0 average value for a columen of test samples, grouped by the test sample types.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this topic from 2012, that looked like it would work:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Determine-column-mean-by-day-and-within-certain-hours/m-p/5477/highlight/true" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Determine-column-mean-by-day-and-within-certain-hours/m-p/5477/highlight/true&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The recommended syntax there is:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Col Mean( If( 1 &amp;lt;= :Hour &amp;lt;= 10, :x, Empty() ), :Day )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, when I try to use something similar with my data set, I get an "argument should be numeric 1 times at rows: 2" error.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is the syntax I'm trying to use.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Col Mean(If( :DH hours == 0, :pm_mw, Empty() ), :Substrate)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can get the forumla to execute correctly if I eliminate the by variable:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Col Mean(If( :DH hours == 0, :pm_mw, Empty() ))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Similarly, I can get it to evaluate correctly if I eliminate the I statement:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Col Mean(:pm_mw, :Substrate)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And finally, I can get it to evaluate correctly if all the values for DH hours in the table are 0. But if there are any non-0 values for DH hours in the table, it won't evalute.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any suggestions would be appreciated.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 22:25:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-use-an-if-statement-and-a-by-variable-correctly-in-a/m-p/40229#M23541</guid>
      <dc:creator>rperkins</dc:creator>
      <dc:date>2017-06-09T22:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use an if statement and a by variable correctly in a column mean formula?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-use-an-if-statement-and-a-by-variable-correctly-in-a/m-p/40231#M23542</link>
      <description>&lt;P&gt;Instead of empty(), use a missing value, represented by period.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="formula column using ColMean" style="width: 700px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/6423i7F618BE749275741/image-size/large?v=v2&amp;amp;px=999" role="button" title="missing.PNG" alt="formula column using ColMean" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;formula column using ColMean&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2017 01:48:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-use-an-if-statement-and-a-by-variable-correctly-in-a/m-p/40231#M23542</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2017-06-10T01:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use an if statement and a by variable correctly in a column mean formula?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-use-an-if-statement-and-a-by-variable-correctly-in-a/m-p/40281#M23585</link>
      <description>Thanks Craig. This worked.&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Jun 2017 15:51:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-use-an-if-statement-and-a-by-variable-correctly-in-a/m-p/40281#M23585</guid>
      <dc:creator>rperkins</dc:creator>
      <dc:date>2017-06-12T15:51:40Z</dc:date>
    </item>
  </channel>
</rss>

