<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Between Function</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: David</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/#comment-18243</link>
		<dc:creator>David</dc:creator>
		<pubDate>Fri, 13 Jan 2006 23:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1314#comment-18243</guid>
		<description>&lt;p&gt;Ok, one of us has misread the spec, and it turns out that it&#039;s ... me.  I have been seeking to show A1 is between A2 and A3; should be A2 between A1 and A3.&lt;/p&gt;
&lt;p&gt;I like the formula&#039;s simplicity too, but on more careful inspection you are right; it behaves splendidly except where A2 coincides with A1 or A3.  In those circumstances what it returns depends on whether the numbers are ascending or descending.&lt;/p&gt;
&lt;p&gt;The issue is that A1&lt;A2 is not the same as NOT(A2&gt;A1); it&#039;s equivalent to NOT(A2&gt;=A1).  The handling of the boundary condition is therefore sensitive to the ordering of the numbers.&lt;/p&gt;
&lt;p&gt;There&#039;s an interesting lesson here.  I tested my code with hundreds of random A1, A2, A3, each between -0.5 and +0.5  But because these are real numbers, I never got any exact matches.  You rightly tested the boundary conditions with integers and identified the issue you raised.  Much better.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ok, one of us has misread the spec, and it turns out that it&#8217;s &#8230; me.  I have been seeking to show A1 is between A2 and A3; should be A2 between A1 and A3.</p>
<p>I like the formula&#8217;s simplicity too, but on more careful inspection you are right; it behaves splendidly except where A2 coincides with A1 or A3.  In those circumstances what it returns depends on whether the numbers are ascending or descending.</p>
<p>The issue is that A1&lt;A2 is not the same as NOT(A2&gt;A1); it&#8217;s equivalent to NOT(A2&gt;=A1).  The handling of the boundary condition is therefore sensitive to the ordering of the numbers.</p>
<p>There&#8217;s an interesting lesson here.  I tested my code with hundreds of random A1, A2, A3, each between -0.5 and +0.5  But because these are real numbers, I never got any exact matches.  You rightly tested the boundary conditions with integers and identified the issue you raised.  Much better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric W. Bachtal</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/#comment-18237</link>
		<dc:creator>Eric W. Bachtal</dc:creator>
		<pubDate>Fri, 13 Jan 2006 21:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1314#comment-18237</guid>
		<description>&lt;p&gt;David, I didn&#039;t mention that formula in my comment because I was having some trouble getting it to return TRUE for 1,2,3 and 3,2,1, and didn&#039;t have time to look closer at it.  I did get it to work like this:&lt;/p&gt;
&lt;p&gt;=(A1&lt;A2)=(A2&lt;A3)&lt;/p&gt;
&lt;p&gt;However, it is inconsistent against the matching value sets in my prior post, returning FALSE for the 1st and 3nd ones, but TRUE for all the others.&lt;/p&gt;
&lt;p&gt;Of course, there&#039;s a good chance I&#039;ve done something wrong.  I do like its simplicity, and its support of strings is a plus, so can you clarify what&#039;s happening with simple ascending/descending sets?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>David, I didn&#8217;t mention that formula in my comment because I was having some trouble getting it to return TRUE for 1,2,3 and 3,2,1, and didn&#8217;t have time to look closer at it.  I did get it to work like this:</p>
<p>=(A1&lt;A2)=(A2&lt;A3)</p>
<p>However, it is inconsistent against the matching value sets in my prior post, returning FALSE for the 1st and 3nd ones, but TRUE for all the others.</p>
<p>Of course, there&#8217;s a good chance I&#8217;ve done something wrong.  I do like its simplicity, and its support of strings is a plus, so can you clarify what&#8217;s happening with simple ascending/descending sets?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/#comment-18221</link>
		<dc:creator>David</dc:creator>
		<pubDate>Fri, 13 Jan 2006 17:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1314#comment-18221</guid>
		<description>&lt;p&gt;Sorry to bounce up and down saying &quot;Mine&#039;s the best! Me! Me!&quot; like a small child, but I really do think that suggestion 8 is the most direct expression of the problem; it will be the fastest to execute; and it will work for all inputs, not just numbers.  &lt;/p&gt;
&lt;p&gt;The number A1 will be between A2 and A3 if it is bigger than A2 and smaller than A3.  In these circumstances&lt;br&gt;
   =(A1&gt;A2)=(A1&lt;A3)&lt;br&gt;
evaluates to&lt;br&gt;
   =TRUE=TRUE&lt;br&gt;
which in turn evaluates to TRUE.&lt;/p&gt;
&lt;p&gt;Alternatively, A2 and A3 and may be in descending order.  If A1 is between them, then&lt;br&gt;
   =(A1&gt;A2)=(A1&lt;A3)&lt;br&gt;
evaluates to&lt;br&gt;
   =FALSE=FALSE&lt;br&gt;
which in turn evaluates to TRUE.&lt;/p&gt;
&lt;p&gt;Under any other circumstances, the formula evaluates to  =TRUE=FALSE or =FALSE=TRUE, which evaluates to FALSE.&lt;/p&gt;
&lt;p&gt;This can trivially be changed to include the boundary conditions (&gt;= instead of &gt;) etc.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Sorry to bounce up and down saying &#8220;Mine&#8217;s the best! Me! Me!&#8221; like a small child, but I really do think that suggestion 8 is the most direct expression of the problem; it will be the fastest to execute; and it will work for all inputs, not just numbers.  </p>
<p>The number A1 will be between A2 and A3 if it is bigger than A2 and smaller than A3.  In these circumstances<br />
   =(A1&gt;A2)=(A1&lt;A3)<br />
evaluates to<br />
   =TRUE=TRUE<br />
which in turn evaluates to TRUE.</p>
<p>Alternatively, A2 and A3 and may be in descending order.  If A1 is between them, then<br />
   =(A1&gt;A2)=(A1&lt;A3)<br />
evaluates to<br />
   =FALSE=FALSE<br />
which in turn evaluates to TRUE.</p>
<p>Under any other circumstances, the formula evaluates to  =TRUE=FALSE or =FALSE=TRUE, which evaluates to FALSE.</p>
<p>This can trivially be changed to include the boundary conditions (&gt;= instead of &gt;) etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jkpieterse</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/#comment-18214</link>
		<dc:creator>jkpieterse</dc:creator>
		<pubDate>Fri, 13 Jan 2006 15:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1314#comment-18214</guid>
		<description>&lt;p&gt;Excellent summary Eric.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Excellent summary Eric.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric W. Bachtal</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/#comment-18209</link>
		<dc:creator>Eric W. Bachtal</dc:creator>
		<pubDate>Fri, 13 Jan 2006 09:36:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1314#comment-18209</guid>
		<description>&lt;p&gt;What a great bunch of suggestions!  Looking them over, though, it&#039;s clear that the applicability of many of them to the stated problem rests on what the author intended to happen with matching values.  In other words, are the following (horizontal) sets meant to be TRUE or FALSE:&lt;/p&gt;
&lt;p&gt;1,1,3&lt;br&gt;
3,3,1&lt;br&gt;
1,3,3&lt;br&gt;
3,1,1&lt;br&gt;
1,1,1&lt;/p&gt;
&lt;p&gt;Based on the author&#039;s first formula, I assumed that matching values did not constitute &quot;between&quot;, and so the COVAR-based solution I offered returns FALSE for all of these sets.&lt;/p&gt;
&lt;p&gt;Likewise, the elegant multiplication-of-neighbor-differences solution offered by Lori (and repeated with a correction for the &quot;&lt;&quot; by Dave, and similar to Kim&#039;s SIGN-based solution, but without the function call) consistently returns FALSE for all of these sets.  But, as a bonus, it can easily be made to return TRUE by changing the &lt;0 to &lt;=0.&lt;/p&gt;
&lt;p&gt;The RANK-based solution offered by jkpieterse returns TRUE for the first and fourth sets, but FALSE for the other three.&lt;/p&gt;
&lt;p&gt;The wonderfully simple LARGE/SMALL-based solution from Michael consistently returns TRUE for all of these sets.&lt;/p&gt;
&lt;p&gt;Seeing the AVERAGE-based solution from David Wasserman got me thinking about another Excel function, TRIMMEAN, resulting in the following solution, which also consistently returns TRUE for all of these sets:&lt;/p&gt;
&lt;p&gt;=TRIMMEAN(A1:A3,2/3)=A2&lt;/p&gt;
&lt;p&gt;In the end, though, I might agree with The Contrarian and David that the author&#039;s first and most verbose formula may prove to be best in the long run, as it is infinitely clearer about its intention than many of the proposed solutions and it has the added (and not insignificant) benefit of working with strings as well as numbers.  So, here&#039;s to being verbose:&lt;/p&gt;
&lt;p&gt;=OR(AND(A2&gt;A1,A2&lt;A3 ),AND(A2&lt;A1,A2&gt;A3))&lt;/p&gt;
&lt;p&gt;Simply add =&#039;s as necessary to get TRUE for the sets shown above.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>What a great bunch of suggestions!  Looking them over, though, it&#8217;s clear that the applicability of many of them to the stated problem rests on what the author intended to happen with matching values.  In other words, are the following (horizontal) sets meant to be TRUE or FALSE:</p>
<p>1,1,3<br />
3,3,1<br />
1,3,3<br />
3,1,1<br />
1,1,1</p>
<p>Based on the author&#8217;s first formula, I assumed that matching values did not constitute &#8220;between&#8221;, and so the COVAR-based solution I offered returns FALSE for all of these sets.</p>
<p>Likewise, the elegant multiplication-of-neighbor-differences solution offered by Lori (and repeated with a correction for the &#8220;&lt;&#8221; by Dave, and similar to Kim&#8217;s SIGN-based solution, but without the function call) consistently returns FALSE for all of these sets.  But, as a bonus, it can easily be made to return TRUE by changing the &lt;0 to &lt;=0.</p>
<p>The RANK-based solution offered by jkpieterse returns TRUE for the first and fourth sets, but FALSE for the other three.</p>
<p>The wonderfully simple LARGE/SMALL-based solution from Michael consistently returns TRUE for all of these sets.</p>
<p>Seeing the AVERAGE-based solution from David Wasserman got me thinking about another Excel function, TRIMMEAN, resulting in the following solution, which also consistently returns TRUE for all of these sets:</p>
<p>=TRIMMEAN(A1:A3,2/3)=A2</p>
<p>In the end, though, I might agree with The Contrarian and David that the author&#8217;s first and most verbose formula may prove to be best in the long run, as it is infinitely clearer about its intention than many of the proposed solutions and it has the added (and not insignificant) benefit of working with strings as well as numbers.  So, here&#8217;s to being verbose:</p>
<p>=OR(AND(A2&gt;A1,A2&lt;A3 ),AND(A2&lt;A1,A2&gt;A3))</p>
<p>Simply add =&#8217;s as necessary to get TRUE for the sets shown above.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Wasserman</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/#comment-18207</link>
		<dc:creator>David Wasserman</dc:creator>
		<pubDate>Fri, 13 Jan 2006 03:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1314#comment-18207</guid>
		<description>&lt;p&gt;oops, meant to use the less than sign...&lt;/p&gt;
&lt;p&gt;=ABS(A2-AVERAGE(A1,A3))&lt;=AVERAGE(A1,A3)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>oops, meant to use the less than sign&#8230;</p>
<p>=ABS(A2-AVERAGE(A1,A3))&lt;=AVERAGE(A1,A3)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Wasserman</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/#comment-18206</link>
		<dc:creator>David Wasserman</dc:creator>
		<pubDate>Fri, 13 Jan 2006 03:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1314#comment-18206</guid>
		<description>&lt;p&gt;Mathematically, this should work...&lt;/p&gt;
&lt;p&gt;=ABS(A2-Average(A1,A3))&gt;=Average(A1,A3)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Mathematically, this should work&#8230;</p>
<p>=ABS(A2-Average(A1,A3))&gt;=Average(A1,A3)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/#comment-18205</link>
		<dc:creator>David</dc:creator>
		<pubDate>Thu, 12 Jan 2006 19:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1314#comment-18205</guid>
		<description>&lt;p&gt;Problem with solutions involving SIGN, COVAR etc is that they work for numeric inputs only.  Why make the spreadsheet brittle in that way when it&#039;s not necessary?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Problem with solutions involving SIGN, COVAR etc is that they work for numeric inputs only.  Why make the spreadsheet brittle in that way when it&#8217;s not necessary?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/#comment-18204</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Thu, 12 Jan 2006 18:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1314#comment-18204</guid>
		<description>&lt;p&gt;=(A2-A1)*(A2-A3)&lt;0&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>=(A2-A1)*(A2-A3)&lt;0</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lori</title>
		<link>http://www.dailydoseofexcel.com/archives/2006/01/12/between-function/#comment-18202</link>
		<dc:creator>Lori</dc:creator>
		<pubDate>Thu, 12 Jan 2006 18:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1314#comment-18202</guid>
		<description>&lt;p&gt;Or (a2-a1)*(a2-a3)&amp;lt0&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Or (a2-a1)*(a2-a3)&amp;lt0</p>
]]></content:encoded>
	</item>
</channel>
</rss>

