<?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: The Switch function</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2005/02/21/the-switch-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2005/02/21/the-switch-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: Tushar Mehta</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/02/21/the-switch-function/#comment-8969</link>
		<dc:creator>Tushar Mehta</dc:creator>
		<pubDate>Sun, 27 Feb 2005 16:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1031#comment-8969</guid>
		<description>&lt;p&gt;Hi JPG,&lt;/p&gt;
&lt;p&gt;Yes, Switch can be a useful tool together with IIf.  I&#039;ve used them as well as Choose for several years.  Note that CHOOSE is also available in XL.&lt;/p&gt;
&lt;p&gt;It&#039;s unfortunate that VB evaluates all choices and possible results before making any decisions (but that is also true for its handling of boolean operators).  That reduces the value of constructs such as IIf some since one cannot create&lt;br&gt;
rslt=IIf(i&gt;ubound(arr),False,arr(i)).&lt;/p&gt;
&lt;p&gt;Also, and I don&#039;t know why, but MS didn&#039;t extend IIf into VBScript (and hence ASP).  This lack makes for some very clumsy code constructs. :(&lt;/p&gt;
&lt;p&gt;Finally, yes, I know one can easily implement one&#039;s own version of IIfwith&lt;br&gt;
Function IIf(c,t,f):If c then IIf=t else IIf=f:End function&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi JPG,</p>
<p>Yes, Switch can be a useful tool together with IIf.  I&#8217;ve used them as well as Choose for several years.  Note that CHOOSE is also available in XL.</p>
<p>It&#8217;s unfortunate that VB evaluates all choices and possible results before making any decisions (but that is also true for its handling of boolean operators).  That reduces the value of constructs such as IIf some since one cannot create<br />
rslt=IIf(i&gt;ubound(arr),False,arr(i)).</p>
<p>Also, and I don&#8217;t know why, but MS didn&#8217;t extend IIf into VBScript (and hence ASP).  This lack makes for some very clumsy code constructs. <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Finally, yes, I know one can easily implement one&#8217;s own version of IIfwith<br />
Function IIf(c,t,f):If c then IIf=t else IIf=f:End function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/02/21/the-switch-function/#comment-8855</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Wed, 23 Feb 2005 17:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1031#comment-8855</guid>
		<description>&lt;p&gt;Yes, it&#039;s a useful function. One Iuse extensively in SQL / Crystal reports... In fact it was by accident that I discovered it was also valid in VBA :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Yes, it&#8217;s a useful function. One Iuse extensively in SQL / Crystal reports&#8230; In fact it was by accident that I discovered it was also valid in VBA <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/02/21/the-switch-function/#comment-8844</link>
		<dc:creator>Joseph</dc:creator>
		<pubDate>Tue, 22 Feb 2005 19:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1031#comment-8844</guid>
		<description>&lt;p&gt;Very cool.&lt;/p&gt;
&lt;p&gt;Your use of SWITCH is a natural in this case because OptionButtons only have two states, True and False.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Very cool.</p>
<p>Your use of SWITCH is a natural in this case because OptionButtons only have two states, True and False.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laetitia</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/02/21/the-switch-function/#comment-8843</link>
		<dc:creator>Laetitia</dc:creator>
		<pubDate>Tue, 22 Feb 2005 19:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1031#comment-8843</guid>
		<description>&lt;p&gt;First of all I want to thank Dick for building such a great blog and all that are sharing valuable tips. I have a problem about excel chart and will appreciate if someone here can give me some hint. I have lots of charts from Excel. When I forward these charts to the graphic designer who will use them to make a handbook, she has trouble to select the colors as Excel charts don&#039;t seem to have CMYK. So she needs to edit every single chart to make them printable. In order to relieve her burdon, I am thinking if there is something that can make Excel charts compatible with her photoshop or something. Would anyone have an idea? Thank you in advance!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>First of all I want to thank Dick for building such a great blog and all that are sharing valuable tips. I have a problem about excel chart and will appreciate if someone here can give me some hint. I have lots of charts from Excel. When I forward these charts to the graphic designer who will use them to make a handbook, she has trouble to select the colors as Excel charts don&#8217;t seem to have CMYK. So she needs to edit every single chart to make them printable. In order to relieve her burdon, I am thinking if there is something that can make Excel charts compatible with her photoshop or something. Would anyone have an idea? Thank you in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie Collins</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/02/21/the-switch-function/#comment-8838</link>
		<dc:creator>Jamie Collins</dc:creator>
		<pubDate>Tue, 22 Feb 2005 09:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1031#comment-8838</guid>
		<description>&lt;p&gt;Because Switch() forms part of VBA5, it can be used in MS Access/Jet SQL syntax e.g.&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container text default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;text codecolorer&quot;&gt;SELECT CompanyName, SWITCH(&lt;br&gt;
&#160; Country IN (&#039;Canada&#039;, &#039;Mexico&#039;, &#039;USA&#039;), &#039;North America&#039;, &lt;br&gt;
&#160; Country IN (&#039;Argentina&#039;, &#039;Brazil&#039;, &#039;Venezuela&#039;), &#039;South America&#039;, &lt;br&gt;
&#160; Country IS NULL, &#039;(Not Known)&#039;, &lt;br&gt;
&#160; TRUE, &#039;Rest of the world&#039;) &lt;br&gt;
AS Locale FROM Customers;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The fact Switch() is &#039;not necessarily mutually exclusive&#039; is an advantage when you consider the alternative is a set of nested/concatenated IIf statements. &lt;/p&gt;
&lt;p&gt;Jamie.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Because Switch() forms part of VBA5, it can be used in MS Access/Jet SQL syntax e.g.</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container text default">
<div style="white-space: nowrap;" class="text codecolorer">SELECT CompanyName, SWITCH(<br />
&nbsp; Country IN (&#8216;Canada&#8217;, &#8216;Mexico&#8217;, &#8216;USA&#8217;), &#8216;North America&#8217;, <br />
&nbsp; Country IN (&#8216;Argentina&#8217;, &#8216;Brazil&#8217;, &#8216;Venezuela&#8217;), &#8216;South America&#8217;, <br />
&nbsp; Country IS NULL, &#8216;(Not Known)&#8217;, <br />
&nbsp; TRUE, &#8216;Rest of the world&#8217;) <br />
AS Locale FROM Customers;</div>
</div>
<p>The fact Switch() is &#8216;not necessarily mutually exclusive&#8217; is an advantage when you consider the alternative is a set of nested/concatenated IIf statements. </p>
<p>Jamie.</p>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Glancy</title>
		<link>http://www.dailydoseofexcel.com/archives/2005/02/21/the-switch-function/#comment-8834</link>
		<dc:creator>Doug Glancy</dc:creator>
		<pubDate>Mon, 21 Feb 2005 23:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1031#comment-8834</guid>
		<description>&lt;p&gt;I think VB.net actually has a Select Case True syntax.  The criticism I&#039;ve read is that the comparisons can be poorly structured, i.e., not necessarily mutually exclusive:&lt;/p&gt;
&lt;p&gt;DougsPhysique = Switch(DougIsTall, 1, DougIsFunnyLooking,2)&lt;/p&gt;
&lt;p&gt;But your example looks like a handy way to make a concise Case statement, as you said.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I think VB.net actually has a Select Case True syntax.  The criticism I&#8217;ve read is that the comparisons can be poorly structured, i.e., not necessarily mutually exclusive:</p>
<p>DougsPhysique = Switch(DougIsTall, 1, DougIsFunnyLooking,2)</p>
<p>But your example looks like a handy way to make a concise Case statement, as you said.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

