<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Excel &#38; VBA - Databison</title>
	<atom:link href="http://www.databison.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.databison.com</link>
	<description>Excel Formula, Charts, Macro, VBA and Tips</description>
	<lastBuildDate>Fri, 29 Mar 2013 18:27:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Prevent Users Ctrl Break (ing) Your VBA Code During Execution</title>
		<link>http://www.databison.com/index.php/prevent-users-ctrl-break-ing-your-vba-code-during-execution/</link>
		<comments>http://www.databison.com/index.php/prevent-users-ctrl-break-ing-your-vba-code-during-execution/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 05:22:31 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[excel macro and vba]]></category>
		<category><![CDATA[vba error]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4519</guid>
		<description><![CDATA[Anytime I write VBA code that runs for more than a split second, one of my worries remains that someone will ctrl + break it. You see, I am a very strong supporter of P.E.T.A. (People for Ethical Treatment of Algorithms) and believe that any code, no matter how long it takes (or in my [...]]]></description>
			<content:encoded><![CDATA[<p>Anytime I write VBA code that runs for more than a split second, one of my worries remains that someone will ctrl + break it. You see, I am a very strong supporter of P.E.T.A. (People for Ethical Treatment of Algorithms) and believe that any code, no matter how long it takes (or in my case how badly written it is), must be allowed the dignity to complete. And for those who believe in killing poor little VBA code(s) with a ctrl + break, I just got a neat little trick up my sleeve. Here&#8217;s how it goes:</p>
<p>Take for example some VBA code that runs for a few seconds. It is important that the user let it run for that duration without stopping code execution since there are a lot of intermediate sheets, rows and columns that the code generates and subsequently deletes before exiting. <b><a href="http://www.databison.com/index.php/vba-if-function-using-if-else-elseif-if-then-in-vba-code/">If</a></b> the user stops the code execution in between, they are left with a pretty ugly spreadsheet. (&#8230; now I know that opening the workbook again is always an option but hey that wouldn&#8217;t be half the fun would it <img src='http://www.databison.com/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> &#8230;)</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/03/prevent-ctrl-break.png"><img src="http://www.databison.com/wp-content/uploads/2010/03/prevent-ctrl-break.png" alt="prevent-ctrl-break" title="prevent-ctrl-break" width="376" height="213" class="alignnone size-full wp-image-4520" /></a></p>
<p>So the trick to prevent VBA code execution by pressing ctrl + break is to insert this magic statement in the VBA code:</p>
<div class="codecolorer-container vb mac-classic" style="overflow:auto;white-space:nowrap;width:535px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="vb codecolorer" style="font-family:Monaco,Lucida Console,monospace">Application.EnableCancelKey = xlErrorHandler</div></td></tr></tbody></table></div>
<p>The statement instructs Excel to not show the &#8220;Code execution has been interrupted&#8221; message and provides a way for the developer to tap into the ctrl + break action by the user. Essentially there can be three values for Application.EnableCancelKey : xlDisabled, xlErrorHandler and xlInterrupt. By setting <em>Application.EnableCancelKey = xlDisabled</em>, we are essentially telling the application to stop responding to the ctrl + break command from the user. If the code runs haywire &#8230; too bad. The <em>xlInterrupt</em> is the normal course of action where the user can terminate the code and is the value that the application resets to after the code has run its course. The <em>xlErrorHandler</em> is the one that lets the developer instruct the application generate an error (code 18) and then to tap into that error by using <a href="http://www.databison.com/index.php/fix-runtime-error-in-vba/"><b>error handling</b></a>.</p>
<p>Here is a code that is supposed to run for 5 seconds. If the user tries to stop the code prematurely, the xlErrorHandler kicks in and let the application raise an error. This error is then tapped by the error handler (On Error GoTo MyErrorHandler) and error handing code, after checking for the exact error code (error code 18 in this case), lets the code execution resume from where it left off.</p>
<div class="codecolorer-container vb mac-classic" style="overflow:auto;white-space:nowrap;width:535px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="vb codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw1">Sub</span> code_that_runs_5_seconds()<br />
<span class="kw1">On</span> <span class="kw1">Error</span> <span class="kw1">GoTo</span> MyErrorHandler:<br />
t = Timer<br />
Application.EnableCancelKey = xlErrorHandler<br />
<br />
<span class="kw1">Do</span> <span class="kw1">While</span> Timer - t &lt; 5<br />
<span class="kw1">Loop</span><br />
<br />
MyErrorHandler:<br />
<span class="kw1">If</span> Err.Number = 18 <span class="kw1">Then</span><br />
&nbsp; &nbsp; MsgBox &quot;Stop hitting ctrl + break !!!&quot;<br />
&nbsp; &nbsp; <span class="kw1">Resume</span><br />
<span class="kw1">Else</span><br />
&nbsp; &nbsp; <span class="co1">'Do something to make your impatient user happy<br />
</span><span class="kw1">End</span> <span class="kw1">If</span><br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div></td></tr></tbody></table></div>
<p>Another interesting thing to note is that you can have more than one Application.EnableCancelKey instructions in a piece of code. For the portions of the code over which you (the developer) want to exert control, you can have it set to xlErrorHandler and for the other pieces you can let the user retain it by setting it to xlInterrupt later down the line.</p>
<div class="codecolorer-container vb mac-classic" style="overflow:auto;white-space:nowrap;width:535px;height:300px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br /></div></td><td><div class="vb codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw1">Sub</span> another_code_that_runs_5_seconds()<br />
<span class="kw1">On</span> <span class="kw1">Error</span> <span class="kw1">GoTo</span> MyErrorHandler:<br />
t = Timer<br />
Application.EnableCancelKey = xlErrorHandler<br />
<br />
<span class="kw1">Do</span> <span class="kw1">While</span> Timer - t &lt; 5<br />
<span class="kw1">Loop</span><br />
MsgBox 1<br />
Application.EnableCancelKey = xlInterrupt<br />
<br />
<span class="kw1">Do</span> <span class="kw1">While</span> Timer - t &lt; 10<br />
<span class="kw1">Loop</span><br />
<br />
MyErrorHandler:<br />
<span class="kw1">If</span> Err.Number = 18 <span class="kw1">Then</span><br />
&nbsp; &nbsp; MsgBox &quot;Stop hitting ctrl + break&quot;<br />
&nbsp; &nbsp; <span class="kw1">Resume</span><br />
<span class="kw1">Else</span><br />
&nbsp; &nbsp; <span class="co1">'Do something to make your impatient user happy<br />
</span><span class="kw1">End</span> <span class="kw1">If</span><br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div></td></tr></tbody></table></div>
<p>Go ahead &#8211; take control <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>You can download an example <a href="http://www.databison.com/wp-content/uploads/2010/03/vba-code-prevent-ctrl-break.xls"><b>here</b></a> here or click on the button below</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/03/vba-code-prevent-ctrl-break.xls"><img src="http://www.databison.com/wp-content/uploads/2009/06/download.png" alt="vba-code-prevent-ctrl-break-code-execution" title="vba-code-prevent-ctrl-break-code-execution" width="240" height="60" class="alignnone size-full wp-image-1658" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/prevent-users-ctrl-break-ing-your-vba-code-during-execution/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Cricketing Heat Map</title>
		<link>http://www.databison.com/index.php/cricketing-heat-map/</link>
		<comments>http://www.databison.com/index.php/cricketing-heat-map/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 06:42:37 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[excel chart]]></category>
		<category><![CDATA[conditional formatting]]></category>
		<category><![CDATA[heatmap]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4497</guid>
		<description><![CDATA[Heat maps are pretty versatile. They have been used for everything ranging from charting home prices to changes in the stock market. (Average Listing Price for US states, week ending Feb 17, 2010. Source : www.trulia.com) (SNP performance, Feb 19, 2010. Source : www.finviz.com/map.ashx) Inspired by the last ball win over the South Africans yesterday [...]]]></description>
			<content:encoded><![CDATA[<p>Heat maps are pretty versatile. They have been used for everything ranging from charting home prices to changes in the stock market.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/heat-map-avg-listing-home-price-trulia.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/heat-map-avg-listing-home-price-trulia.png" alt="heat-map-avg-listing-home-price-trulia" title="heat-map-avg-listing-home-price-trulia" class="alignnone size-full wp-image-4498" /></a><br />
<em>(Average Listing Price for US states, week ending Feb 17, 2010. <strong>Source :</strong> www.trulia.com)</em></p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/heat-map-snp-500-finviz.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/heat-map-snp-500-finviz.png" alt="heat-map-snp-500-finviz" title="heat-map-snp-500-finviz" class="alignnone size-full wp-image-4499" /></a><br />
<em>(SNP performance, Feb 19, 2010. <strong>Source :</strong> www.finviz.com/map.ashx)</em></p>
<p>Inspired by the last ball win over the South Africans yesterday night, I wondered if some of that action could be captured in a graph. One of the interesting approaches that came to mind was a heat map. But before we go further, here&#8217;s how a normal scorecard would look like at the end of the match.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/scorecard.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/scorecard_small.png" alt="scorecard_small" title="scorecard_small" width="465" height="373" class="alignnone size-full wp-image-4500" /></a><br />
<em>(Click on image to open the full scorecard)</em></p>
<p>As you can see, this is clear and concise and probably the best thing to use if one were interested in knowing who scored how much and how well the bowlers bowled. But this does not give you quite the <em>feel</em> of how the match went ball by ball. While it does tell  you that the match went down to the wire, it does let the user form an idea of <strong>what</strong> caused it to go went that way.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/jacques-kallis-sweeps.jpg"><img src="http://www.databison.com/wp-content/uploads/2010/02/jacques-kallis-sweeps.jpg" alt="jacques-kallis-sweeps" title="jacques-kallis-sweeps" class="alignnone size-full wp-image-4502" /></a></p>
<p>So here&#8217;s what a <strong>cricketing heat map</strong> would look like.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/cricketing-heatmap.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/cricketing-heatmap.png" alt="cricketing-heat-map" title="cricketing-heat-map" class="alignnone size-full wp-image-4503" /></a><br />
<em>(This is not a reproduction of the match mentioned above)</em></p>
<p>For how this was done:</p>
<h2>Tabulate the Match Data</h2>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/cricket-match-data.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/cricket-match-data.png" alt="cricket-match-data" title="cricket-match-data" class="alignnone size-full wp-image-4505" /></a></p>
<p>Data above all else !!! So here goes the data into a spreadsheet.</p>
<h2>Creating the Data Table</h2>
<p>Read the data from the tabulation sheet and lay out the grid on which the heatmap can be superimposed. We would need to use a few excel formulas out here.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/heat-map-conditional-formatting.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/heat-map-conditional-formatting.png" alt="heat-map-conditional-formatting" title="heat-map-conditional-formatting" class="alignnone size-full wp-image-4504" /></a></p>
<h2>Using Conditional Formatting for Creating a Heat Map</h2>
<p>While conditional formatting was limited to 3 conditions in Excel 2003 &#038; earlier, Excel 2007 onwards that got changed. So we can have separate color coding for each category on run scored (0 to 6).</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/conditonal-formatting-to-create-heatmap.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/conditonal-formatting-to-create-heatmap.png" alt="conditonal-formatting-to-create-heatmap" title="conditonal-formatting-to-create-heatmap" class="alignnone size-full wp-image-4506" /></a></p>
<p>Once we have these steps done, we would need to resize the rows, extend the conditional formatting to all the cells and add a color legend.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/cricketing-heat-map/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Opera Anyone ?</title>
		<link>http://www.databison.com/index.php/opera-anyone/</link>
		<comments>http://www.databison.com/index.php/opera-anyone/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 05:47:30 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4435</guid>
		<description><![CDATA[Looks like I am not the only one suffering from browse fatigue. Excel guru Dick Kusleika recently made the shift from Firefox to Chrome and he wasn&#8217;t very impressed. I myself have been fiddling around with various browsers lately. Right before my earlier computer gave up the ghost and I shifted on to the new [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.databison.com/wp-content/uploads/2010/02/firefox.jpg"><img src="http://www.databison.com/wp-content/uploads/2010/02/firefox.jpg" alt="firefox" title="firefox" width="150" height="142" class="alignright size-full wp-image-4439" /></a>Looks like I am not the only one suffering from browse fatigue. Excel guru <a href="http://www.dailydoseofexcel.com/archives/2010/02/05/google-chrome/"><strong>Dick Kusleika</strong></a> recently made the shift from Firefox to Chrome and he wasn&#8217;t very impressed. I myself have been fiddling around with various browsers lately. Right before <a href="http://www.databison.com/index.php/a-new-rig/"><strong>my earlier computer gave up the ghost</strong></a> and I shifted on to the new one, I had been hell bent on squeezing out the last remaining ounce of performance from it. With 256 MB of some very unreliable RAM and a modest AMD Duron processor, even simple tasks like browsing were a challenge at times. So one day when Internet Explorer crashed right after I had written a part of a particular post, I decided to give Firefox a try. Firefox ran well &#8230; atleast for the first few days and then its RAM hogging tendencies started to show up. While I was thankful for the spell checker and stability, if I were running Firefox, it was the only application my processor would let me run without going molasses.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/chrome.jpg"><img src="http://www.databison.com/wp-content/uploads/2010/02/chrome.jpg" alt="" title="chrome" width="100" height="75" class="alignleft size-full wp-image-4449" /></a>Enter Chrome. A slightly different look and feel but I was willing to live with it if it delivered the goods. However Chrome again, just like Firefox, bloated after a few weeks of usage. Clearing the temporary files folder did not help and the time to start-up was driving me crazy. Internet Explorer for all its drawbacks, comes up really fast (that it takes eons to render a website after showing up is a different story altogether !! ).</p>
<p>So I googled for &#8216;fastest browser&#8217; and <a href="http://www.opera.com/"><b>Opera</b></a> was listed in the first few results. <a href="http://www.databison.com/wp-content/uploads/2010/02/opera.jpg"><img src="http://www.databison.com/wp-content/uploads/2010/02/opera.jpg" alt="opera" title="opera" width="150" height="131" class="alignright size-full wp-image-4441" /></a>Now by this time I was willing to give anything a try, even Opera. An 11 MB executable and a 2 minute install later, I had a smile on my face. Opera is fast and has remained so even after a few months of usage. Of all four IE, Opera, FF and Chrome, Opera is by far the fastest to render a website. It is faster starting up than Firefox and Chrome but slightly slower than IE. It has tabbed browsing, resizable tabs, tabs previewing, speed dialing, download counter, password storage, expandable panels, spell checker, inbuilt search engine box and pretty much all that I would need for blogging and surfing. And I am sure there are a ton of other features that I am not even aware of since I go by just fine using only ones listed above.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/browser-market-share.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/browser-market-share.png" alt="" title="browser-market-share" class="alignnone size-full wp-image-4447" /></a></p>
<p>My own &#8216;in-depth&#8217; research has let me to believe that I fall in the tiny 1.57% portion of web surfers who use Opera. But then this number in reality could very well be lower since a lot of those visits may just be my own <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  It could, in all likelihood, perhaps be even lower since this is an Excel blog and Linux users would be under-represented. Either ways, I will continue to stick with Opera although IE remains a useful 2nd in line.</p>
<p>I am just wondering if there are others who&#8217;ve used Opera? What&#8217;s your experience been like?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/opera-anyone/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Multiple Scale Chart &#8211; Adding Customized Scale to Each Category in a Chart</title>
		<link>http://www.databison.com/index.php/multiple-scale-chart-adding-customized-scale-to-each-category-in-a-chart/</link>
		<comments>http://www.databison.com/index.php/multiple-scale-chart-adding-customized-scale-to-each-category-in-a-chart/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 06:14:58 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[excel chart]]></category>
		<category><![CDATA[chart label]]></category>
		<category><![CDATA[chart scale]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4321</guid>
		<description><![CDATA[So how do you fit multiple scales on a single excel chart? No, we are not referring about the primary and secondary scales on an Excel chart here, we are talking about adding a customized scale for each category in the chart. Take for example the receipts portion of the U.S. federal budget &#8211; a [...]]]></description>
			<content:encoded><![CDATA[<p>So how do you fit multiple scales on a single excel chart? No, we are not referring about the primary and secondary scales on an Excel chart here, we are talking about adding a customized scale for each category in the chart.</p>
<p>Take for example the receipts portion of the U.S. federal budget &#8211; a data set with multiple categories such as individual income, social security, excise, estate and other taxes &#038; duties.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/data-multiple-scale-chart-revenue-receipts-budget.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/data-multiple-scale-chart-revenue-receipts-budget.png" alt="data-multiple-scale-chart-revenue-receipts-budget" title="data-multiple-scale-chart-revenue-receipts-budget" width="391" height="132" class="alignnone size-full wp-image-4323" /></a></p>
<p>Now while all these categories pertain to the same universe and are equally important in their own right, the quantum of each category may differ from others in terms of sheer magnitude. So for example while the receipts from the individual income tax might be $ 1,100 billion in a particular year, the corresponding figure for the estate &#038; gift tax might only be $ 26 billion. </p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/single-scale-in-a-chart.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/single-scale-in-a-chart.png" alt="single-scale-in-a-chart" title="single-scale-in-a-chart" class="alignnone size-full wp-image-4359" /></a></p>
<p>If you put compare both these data points using a single chart scale, it does not really help the reader appreciate the size and the magnitude of change for the smaller data points. Using a log scale is an option worth using in many cases but the log scale does suffer from two shortcomings:</p>
<p>a) Log scales do not lend themselves to easy comprehension.<br />
b) When the difference in size of two data points is disproportionately large, a log scale may not always help.</p>
<p>So what about a chart with customized scales for each category &#8211; something like the one shown below. Methinks that a piece of beauty right there. (If you don&#8217;t agree with me, go away and don&#8217;t come back &#8230;. ever <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/multiple-scale-chart.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/multiple-scale-chart.png" alt="multiple-scale-chart" title="multiple-scale-chart" class="alignnone size-full wp-image-4346" /></a></p>
<p>So open up your spreadsheets and put on your thinkers cap &#8217;cause ladies and gentlemen we are going to &#8230;.</p>
<h2>Make a Multiple Scale Chart in Excel</h2>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/multiple-scale-chart-data.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/multiple-scale-chart-data.png" alt="multiple-scale-chart-data" title="multiple-scale-chart-data" width="441" height="601" class="alignnone size-full wp-image-4347" /></a></p>
<p>The data comes first, each and every time. So let&#8217;s generate the data grid for the chart. If you look at it carefully, a number of series have been generated. You can broadly classify them into three groups &#8211; the first that help us plot the actual data points, the second that help us plot the scales and the third ones that we use for the legend. The X and Y values for the actual plot values can be structured using formulas so that they fall between 0 and 10 (or any other scale that one may choose to use). (The trick here is to have them converted to a common scale).</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/xy-chart.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/xy-chart.png" alt="xy-chart" title="xy-chart" class="alignnone size-full wp-image-4348" /></a></p>
<p>Now let&#8217;s draw a simple XY chart. Each row will have to be added as a series and has a name, X and Y values. Typically if our original data set had X data points, we would have to plot an additional of 2X the number of series for the labels for the chart scales. (Essentially the highlighted portion gets converted to individual series of the XY chart.)</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/set-minimum-scale-value-to-zero.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/set-minimum-scale-value-to-zero.png" alt="set-minimum-scale-value-to-zero" title="set-minimum-scale-value-to-zero" width="278" height="67" class="alignright size-full wp-image-4351" /></a>In order to hide the last two points (we will use them later in the legend), we adjust the vertical scale to start at zero. Since the last two points has a Y-value of -1, the sink below the X-axis. To do this, right click on the chart axis and pick &#8216;Format Axis&#8217; and then set the minimum value to 0. While at it, we can also adjust the maximum value of the horizontal scale (X-Axis) and set it to 10. This way the rightmost points align up nicely against the secondary vertical axis. We can obviously the values set of whichever level one wants &#8211; in this case we simply picked up the ones which work for us.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/change-chart-scale-minimum-value.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/change-chart-scale-minimum-value.png" alt="change-chart-scale-minimum-value" title="change-chart-scale-minimum-value" class="alignnone size-full wp-image-4349" /></a></p>
<h2>Adding Scales to the Chart</h2>
<p>Let&#8217;s turn on the labels. Right click on any point and select &#8216;Format Data Series&#8217; (Excel 2003) or &#8216;Format Data Labels&#8217; (Excel 2010). Once you have the labels turned on for the first point, simply use the repeat key (F4) to carry out the same operation on all the other points. Once all the points have been turned on, you will notice that they would typically be positioned towards the right of the point. For the left scale and the first data series, you can have them positioned towards the left (right clicking the first point and on the &#8216;Alignment&#8217; tab change the orientation to left).</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/multiple-scale-chart-turn-on-the-labels.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/multiple-scale-chart-turn-on-the-labels.png" alt="multiple-scale-chart-turn-on-the-labels" title="multiple-scale-chart-turn-on-the-labels" class="alignnone size-full wp-image-4352" /></a></p>
<h2>Add Legend To the Chart</h2>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/chart-legend.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/chart-legend.png" alt="chart-legend" title="chart-legend" class="alignnone size-full wp-image-4353" /></a></p>
<p>Turn on the legend. By default, you will see a number of entries in the legend and we definately don&#8217;t need all of them. The only ones of use are the last two. So one by one, place two slow clicks on each of the legend entries and press the delete key.</p>
<p>Once you have reached this point, take a break. Close your eyes for a while. Imagine a good looking girl / guy walking upto, staring deep into your eyes and and complementing you &#8230; on your Excel skills <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Ok time to wake up and move onto the formatting the chart&#8217;s scales. One by one, hide the points on both the vertical scales. That way only the labels remain visible. Now for the interesting part. We can convert the horizontal chart scale (X-Axis) to show &#8216;min&#8217; and &#8216;max&#8217; strings rather than values from from 0 to 10. How. Simple. You can use <a href="http://www.databison.com/index.php/custom-format-in-excel-how-to-format-numbers-and-text/"><b>custom format</b></a> to change the original scale on the X-axis of the chart to show any text /string that you want based on the specified criteria. In our case, the X-axis has a scale that goes from 0 to 10. So writing a custom format string like:</p>
<p><strong>[=0]&#8220;1997&#8243;;[=10]&#8220;2007&#8243;;</strong></p>
<p>converts a value of 0 on the scale to &#8220;Min&#8217; and a value of 10 on the scale to &#8220;Max&#8221;. The remaining values on the scale are now all hidden.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/hide-chart-scale-label-points.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/hide-chart-scale-label-points.png" alt="hide-chart-scale-label-points" title="hide-chart-scale-label-points"  class="alignnone size-full wp-image-4354" /></a></p>
<p>The end result of all the tinkering is that we have a chart that looks pretty much how we wanted it to be. As you can see, each category in the chart now has a customized scale of its own. From this point, its just a short hop to adding the chart title (of course), coloring gridlines and generally taking care of the placements.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/multiple-scale-chart-plot-values.png"><img src="http://www.databison.com/wp-content/uploads/2010/02/multiple-scale-chart-plot-values.png" alt="multiple-scale-chart-plot-values" title="multiple-scale-chart-plot-values" class="alignnone size-full wp-image-4361" /></a></p>
<p>You can download a copy of the <a href="http://www.databison.com/wp-content/uploads/2010/02/multiple-scale-chart.xls"><b>chart with multiple scales</b></a> here or click on the button below</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/02/multiple-scale-chart.xls"><img src="http://www.databison.com/wp-content/uploads/2009/06/download.png" alt="multiple-scale-chart" title="multiple-scale-chart" width="240" height="60" class="alignnone size-full wp-image-1658" /></a></p>
<p>With Excel, it&#8217;s easy !!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/multiple-scale-chart-adding-customized-scale-to-each-category-in-a-chart/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The Content Aggregator Called Excel</title>
		<link>http://www.databison.com/index.php/the-content-aggregator-called-excel/</link>
		<comments>http://www.databison.com/index.php/the-content-aggregator-called-excel/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 12:30:57 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4299</guid>
		<description><![CDATA[So you have been toiling away on a spreadsheet that must reach the CEO&#8217;s desk before the end of the day. Your boss has been after your life to get this done as fast as possible with his frantic phone calls and a rather sharp pitchfork that he uses on special occasions like these. A [...]]]></description>
			<content:encoded><![CDATA[<p>So you have been toiling away on a spreadsheet that must reach the CEO&#8217;s desk before the end of the day. Your boss has been after your life to get this done as fast as possible with his frantic phone calls and a rather sharp pitchfork that he uses on special occasions like these. A gazillion formulas, allocations and calculations later, with your body screaming for some coffee, you allow yourself a break. As you return to your desk with a cup-full of the gooey thingy that comes out of the coffee machine, you feel like checking the latest scores from the match  your favorite team is playing tonight. &#8220;<em>Ok &#8230; looks like we might &#8230;.</em> &#8221;  &#8211; you turn around and there&#8217;s your boss standing right behind you. Damn #$#%^%&#038;%$.</p>
<p>Excel to the rescue. Did you know that Excel can help you aggregate content from a number of websites in a single spreadsheet? Here&#8217;s how.</p>
<h2>Getting Data From Other Web Sources in Excel</h2>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/get-data-from-web.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/get-data-from-web.png" alt="get-data-from-web" title="get-data-from-web"  class="alignnone size-full wp-image-4300" /></a></p>
<p>Click on the &#8216;Data&#8217; tab on the ribbon and then &#8216;From Web&#8217; button (or &#8216;<strong>Data</strong>&#8216; -> &#8216;<strong>Import External Data</strong>&#8216; -> &#8216;<strong>New Web Query</strong>&#8216; in Excel 2003). A &#8216;New Web Query&#8217; box will open up with the homepage that you&#8217;ve set for Internet Explorer. In the &#8216;Address&#8217; box, type in the URL that you would like to get information from (in our case, we choose Willow.tv to get cricking scores). The various tables on the page will be highlighted in as a yellow square. Once the page has fully loaded in the form, select the table which contains the specific portion that you need. The selected portion will get highlighted in a different color.. Click &#8216;Import&#8217; and wait for the data transfer from the web page to the spreadsheet to complete.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/new-web-query.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/new-web-query.png" alt="" title="new-web-query" class="alignnone size-full wp-image-4301" /></a></p>
<p>Once you have the &#8216;feed&#8217; placed in a spreadsheet, you can format it, hide columns that you don&#8217;t want and make other aesthetic changes.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/feed-from-a-website.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/feed-from-a-website.png" alt="feed-from-a-website" title="feed-from-a-website"  class="alignnone size-full wp-image-4304" /></a></p>
<p>Now comes the interesting part. Right click on the range and select &#8216;<strong>Data Range Properties</strong>&#8216;. Once the form opens, do the following changes:</p>
<p>1. Turn off &#8216;<strong>Adjust Column Width</strong>&#8216; (so that the columns do not resize on refresh)<br />
2. Select &#8216;<strong>Overwrite Existing Cells with New Data</strong>&#8216; (so that the same cells get reused)<br />
3. Change &#8216;<strong>Refresh Every</strong>&#8216; to a lower value say, once every minute (so that we get the new information as fast as possible)</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/external-data-range-properties.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/external-data-range-properties.png" alt="external-data-range-properties" title="external-data-range-properties" width="338" height="460" class="alignnone size-full wp-image-4305" /></a></p>
<p>That&#8217;s it. But wait &#8230; there&#8217;s more to be done. You can scroll down and start over again with an unused cell. This time around let&#8217;s get content from our favorite financial website. So let&#8217;s head over to reuters.com and get  information from the stock exchanges.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/get-stock-market-information-in-a-spreadsheet.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/get-stock-market-information-in-a-spreadsheet.png" alt="get-stock-market-information-in-a-spreadsheet" title="get-stock-market-information-in-a-spreadsheet" class="alignnone size-full wp-image-4306" /></a></p>
<h2>Getting Tweets as Well</h2>
<p>So now we have both sporting and financial information in a single spreadsheet. Let&#8217;s tweet a bit, shall we. Let&#8217;s check out what Barrack Obama is saying.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/getting-tweets-from-twitter.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/getting-tweets-from-twitter.png" alt="getting-tweets-from-twitter" title="getting-tweets-from-twitter" class="alignnone size-full wp-image-4307" /></a></p>
<p>So now we are up-to-the-minute with sports, markets and tweets. Add to this content from your favorite blogs, latest news headlines and throw in a couple of charts n&#8217; pivots and pretty soon we are talking about a pretty serious content aggregator !</p>
<p>So the next time the devil comes calling, tell him that you are still &#8216;checking&#8217; it out <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/the-content-aggregator-called-excel/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Table Formula in Excel (Something I didn&#8217;t Know Till Yesterday)</title>
		<link>http://www.databison.com/index.php/table-formulas-in-excel/</link>
		<comments>http://www.databison.com/index.php/table-formulas-in-excel/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 08:28:29 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[excel formula]]></category>
		<category><![CDATA[excel tips]]></category>
		<category><![CDATA[excel table]]></category>
		<category><![CDATA[table formula]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4267</guid>
		<description><![CDATA[Table formulas were something that I discovered recently. Actually our reader m-b commented that he prefers to convert a range to a table and then employ table formulas instead of named ranges. That got me curious enough to explore them further and here&#8217;s what I learnt. A Table in Excel A table is a feature [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Table formulas</strong> were something that I discovered recently. Actually our reader m-b commented that he prefers to convert a range to a table and then employ table formulas instead of <a href="http://www.databison.com/index.php/named-range-a-few-quickies/"><strong>named ranges</strong></a>. That got me curious enough to explore them further and here&#8217;s what I learnt.</p>
<h2>A Table in Excel</h2>
<p>A table is a feature in Excel that makes it easier to format and analyze a set of data points in a spreadsheet. Tables were introduced in Excel 2007 as an extension of the &#8216;Lists&#8217; feature in the earlier versions. In Excel 2007 onwards, you can also use the <strong>table formulas</strong> to extract data from a table.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/table-formula-in-excel-total.png"><img class="alignnone size-full wp-image-4279" title="table-formula-in-excel-total" src="http://www.databison.com/wp-content/uploads/2010/01/table-formula-in-excel-total.png" alt="table-formula-in-excel-total" width="451" height="290" /></a></p>
<h2>How Does One Create a Table</h2>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/insert-a-table-in-excel.png"><img class="alignnone size-full wp-image-4278" title="insert-a-table-in-excel" src="http://www.databison.com/wp-content/uploads/2010/01/insert-a-table-in-excel.png" alt="insert-a-table-in-excel" /></a></p>
<p>In Excel 2007 and later, all you have to do to convert a given range to a table is to simply select the range and then click the &#8216;Table&#8217; button under the &#8216;Insert&#8217; tab on the ribbon. Better still, as our reader <strong>Sam</strong> pointed out, use the shortcut key <strong>CTRL + T</strong>.</p>
<h2>So What Good is the Table For</h2>
<p>Lots actually.<br />
<a href="http://www.databison.com/wp-content/uploads/2010/01/table-design-excel.png"><img class="alignnone size-full wp-image-4269" title="table-design-excel" src="http://www.databison.com/wp-content/uploads/2010/01/table-design-excel.png" alt="table-design-excel" /></a></p>
<p><strong>Formatting: </strong>Completely change the look and feel of your data with a few mouse clicks</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/total-option.png"><img class="alignright size-full wp-image-4270" title="total-option" src="http://www.databison.com/wp-content/uploads/2010/01/total-option.png" alt="total-option" width="224" height="158" /></a><strong>Summarize by adding row for Total: </strong> Just turn on the check box for &#8216;Total Row&#8217; and you have a new row inserted just below the data set with the totals. Not only totals, you can select any cell in this row and choose from a number of aggregation options such as count, min, max etc.</p>
<p><strong>Export and Share: </strong> Export and share the table with other users using SharePoint</p>
<p><strong>Provide a Name to the Table: </strong>You can give the table a specific name (say &#8216;Sales_Data&#8217;) and use it later in your formulas. To give a new name to the table, open up the &#8216;Name Manager&#8217; under the &#8216;Formulas&#8217; tab and then edit the table name.</p>
<h2>Table Formulas in Excel</h2>
<p><em>&#8220;Flaming Bisons !!! You made me read all this just to show what an Excel table looks like &#8230; I already know what it is so why don&#8217;t you come straight to the point !&#8221;</em></p>
<p>Oh! That was rude. Did nobody ever tell you that patience is a kingly virtue?</p>
<p><strong>Table Formulas</strong> let you access table in a easy and intuitive manner. Let&#8217;s begin by converting a range to a table. When you create a new table, Excel will provide with a default name, say something like &#8216;Table1&#8242;. This may not be most intuitive of names and you may wish to rename it to something else that is easier to remember and comprehend for others. Open the &#8216;Design&#8217; tab and overwrite the text in the &#8216;Table Name&#8217; box to something like &#8216;sales&#8217;.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/name-a-table.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/name-a-table.png" alt="name-a-table" title="name-a-table" class="alignnone size-full wp-image-4296" /></a></p>
<p>The opens up a whole new box of chocolates ! You can now refer to and use the entire table, individual columns, rows, data range, headers or totals in your formulas.</p>
<h3>Using a Specific Column from the Table in a Formula</h3>
<p>Say you wanted to know the average for all items in the &#8216;Revenue&#8217; column. Enter something like <strong>=AVERAGE(sales[Revenue])</strong> in a cell and smile. The formula is so intuitive that it hardly needs explaining. However being the a** I am, let me be me. The &#8216;sales[Revenue]&#8216; string refers the data points in the &#8216;Revenue&#8217; column of the sales table. &#8216;sales[Target'] would have referred to the &#8216;Target&#8217; column of the same table. We can now use this like any other range in any excel formula. So =MAX(sales[Revenue]), =LARGE(sales[Revenue],5) and =COUNT(sales[Revenue]) are all valid formulas.</p>
<h3>Using a Specific Row from the Table in a Formula</h3>
<p>What&#8217;s good for a column is good for the row. Format, however differ. To refer to a row in a table, we use the <strong>@ symbol</strong>. So if you want to refer to the the 10th row in the table, write =sales[@] in any cell in the 10th row. So something like <strong>=countif(sales[@],&#8221;&lt;&gt;&#8221;)</strong> would give you count of non-blank cells in the particular row of the table. If you copy the same formula to the cell immediately below, the corresponding values from the next row would be returned &#8211; even though the formula hasn&#8217;t changed.</p>
<h3>Using the Entire Table in a Formula</h3>
<p>What&#8217;s good for a column and row must be good for the table <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
To refer to the entire table, use : <strong>=sales[#All]</strong><br />
To refer to only the data portion of the table, use  : <strong>=sales[#Data]</strong><br />
To refer to the headers, use : <strong>=sales[#Headers]</strong></p>
<h3>Using the SUBTOTAL Formula with the Table</h3>
<p>Another interesting feature of the Table is the use of <strong>SUBTOTAL </strong>function. The SUBTOTAL formula has two parts &#8211; the first one indicates the formula to use for aggregation and the second one contains the range to use. So =SUBTOTAL(9,A1:A10) would give the sum of the range from A1:A10 while =SUBTOTAL(1,A1:A10) would provide the average for the same range.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/using-subtotal-formula-in-an-excel-table.png"><img class="alignnone size-full wp-image-4275" title="using-subtotal-formula-in-an-excel-table" src="http://www.databison.com/wp-content/uploads/2010/01/using-subtotal-formula-in-an-excel-table.png" alt="using-subtotal-formula-in-an-excel-table" width="250" height="266" /></a></p>
<p>Coming back the the Excel Table, you can aggregate over the entire table (or a portion of it) the values by using the SUBTOTAL formula and providing it with the reference to a particular row, column or the entire table. Just as in the example above, you can get the average of the &#8216;Revenue&#8217; column by using <strong>=SUBTOTAL(1, sales[Revenue])</strong>.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/subtotal-function.png"><img class="alignnone size-full wp-image-4274" title="subtotal-function" src="http://www.databison.com/wp-content/uploads/2010/01/subtotal-function.png" alt="subtotal-function" width="261" height="256" /></a></p>
<p>If you noticed, when we turned on the &#8216;Total Row&#8217; option, a new row with the total for columns got added to the table. We can now go ahead and modify the formulas using any of the formula options shown above. So the totals are not limited to just being summing but can very well be extended to averages, min, max, variance etc.</p>
<h3>Using the Totals for a Particular Column in a Formula</h3>
<p>To refer to the total for a column in the table, say Revenue, we can now write something similar to <strong>=sales[[#Totals],[Revenue]]</strong>. Please note that the &#8216;total&#8217; value returned may not be the total (SUM) but is determined by the SUBTOTAL function parameter used to aggregate the column. Let&#8217;s illustrate this with an example. If the SUBTOTAL formula in the &#8216;Total Row&#8217; for the &#8216;Revenue&#8217; column contained an aggregation function parameter with a value of 4, the total would have returned maximum value from the column. Now when somebody wants to refer to this total using =sales[[#Totals],[Revenue]], the &#8220;total&#8221; returned would not be a sum of column values but the maximum.</p>
<p>I have a feeling that there&#8217;s more that can be done with table formulas. Have you tried using them? Care to share ?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/table-formulas-in-excel/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Multithreaded VBA &#8211; An Approach To Processing Using VBScript</title>
		<link>http://www.databison.com/index.php/multithreaded-vba-an-approach-to-processing-using-vbscript/</link>
		<comments>http://www.databison.com/index.php/multithreaded-vba-an-approach-to-processing-using-vbscript/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 07:02:45 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[excel macro and vba]]></category>
		<category><![CDATA[multithreading vba excel]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4239</guid>
		<description><![CDATA[Today&#8217;s guest post is authored by Daniel Ferry, a longtime professional Excel developer and consultant (and a newbie blogger). A few months ago, I wrote a post on how one can simulate multithreading in VBA using Excel. Daniel picked up a thread from there and commented that he had some good success in marshalling some [...]]]></description>
			<content:encoded><![CDATA[<p><em>Today&#8217;s guest post is authored by <strong>Daniel Ferry</strong>, a longtime professional Excel developer and consultant (and a newbie blogger). A few months ago, I wrote a post on how one can <a href="http://www.databison.com/index.php/simulating-multithreading-in-vba-using-excel/"><b>simulate multithreading in VBA</b></a> using Excel. Daniel picked up a thread from there and commented that he had some good success in marshalling some of windows multithreaded subsystems from within VBA. In this article he describes his approach.</em></p>
<h2>Multithreading VBA &#8211; Using VBScript</h2>
<p>Try as we might to work around it, Excel VBA is a single threaded affair. Still there are times when being able to spin off independent tasks could dramatically speed up processing times, rather than have all tasks follow in order, one after the other, each waiting for the previous one to finish.</p>
<p>There are a number of times when data needs to finally get stored in Excel from data sources or using transfer processes which are far slower than the processing capabilities of Excel / VBA. Downloading information or data stored from a website is one such example. Now, VBA is a capable scripting language and certainly up to the task. However when we scrap a website, VBA has to wait for over 90% of the time for the website server to respond with the requested data. Once the html is on the Excel computer, the parsing out of the data is virtually instantaneous.</p>
<p>If there ever was a task that could benefit from multithreading in VBA, this is it. In the demo workbook included with this post, the reader will find a tool implementing three different strategies for downloading data from a website using Excel. The demo contains a list of 100 property addresses and the tool retrieves valuation data on these properties from <strong>www.realestateabc.com</strong>. The demo also includes controls allowing the user to toggle between the three different techniques and to time them.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/scraping_demo.xls"><img src="http://www.databison.com/wp-content/uploads/2009/06/download.png" alt="multithreading-vba-using-vbscript" title="multithreading-vba-using-vbscript" width="240" height="60" class="alignnone size-full wp-image-1658" /><br /></a></p>
<p>The first technique instantiates Internet Explorer via OLE. While this allows the user to see the pages being scraped, this is by far the worst strategy. IE is bloated and very slow. The second technique uses MSXML2 as a lightweight alternative that is approximately four times swifter than IE.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/msmxml2-vba.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/msmxml2-vba.png" alt="msmxml2-vba" title="msmxml2-vba" class="alignnone size-full wp-image-4243" /></a></p>
<p>These first two techniques are squarely rooted in the single threaded camp, since while they are getting the data Excel is waiting intensely and not able to do much in the meantime. As you can see above, the processing takes place one record at a time and next record is processed only once the previous one has finished. The third innovative technique however, makes this task run much faster and is listed in demo workbook as the Swarm Method.</p>
<p>The Windows Scripting Host is a multithreaded subsystem of the Windows OS that runs VBScript programs. My swarm creates a number of VBScript files in the demo workbook folder and runs them all in the Windows Scripting Host simultaneously. Each one of these agents scrapes one record of valuation data from the website, grabs an OLE handle back to the parent workbook, deposits it data to Excel, and kills itself. The <strong>Worksheet_Change</strong> function senses that a new data record has been entered and creates a new agent to replace the one that just expired, keeping the swarm size in balance.</p>
<p><span id="25012010_1"></span><br />
(<em>For those interested in knowing more about what a .vbs file is, I recommend reading <a href="http://www.databison.com/index.php/multithreaded-vba-an-approach-to-processing-using-vbscript/#25012010_2"><b>this explanation</b></a> before resuming from this point.</em>)</p>
<p>Each agent is programmed with specific range coordinates to deposit the data. The demo includes a control to allow the user to fine tune the number of agents in the swarm. Different computers and versions of Windows can handle different sizes of swarms. Windows Vista seems to have a more robust OLE subsystem, and quite handily tromps on WinXP. On my computer XP performs well with 50 to 60 agents in a swarm, while Vista on the same machine can smoothly handle a couple hundred agents.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/multithreading-using-vbscript.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/multithreading-using-vbscript.png" alt="multithreading-using-vbscript" title="multithreading-using-vbscript" class="alignnone size-full wp-image-4244" /></a></p>
<p>The amount of time that can be saved by this multithreaded technique is impressive. It’s a function of the number of simultaneous agents in the swarm.</p>
<p>When selecting the swarm method in the demo, please be patient as there will be a few seconds of delay before results start returning. But when they do it comes in tsunami fashion! The VBA code is well commented and fairly straightforward. In my opinion it is well worth the time to study the code to see how the three methods are achieved using VBA, especially the Swarm method. Since the demo will be creating a number of .vbs agent files, it is best to create a folder for the demo workbook.</p>
<div class="dotline"></div>
<p><em><strong>Daniel Ferry</strong> is a professional Excel developer and consultant. He has been developing business solutions with Excel for two decades and did the same with Lotus 123 before Excel existed. He has just started his own blog at <a href="http://www.excelhero.com/blog"><b>excelhero.com/blog</b></a>, hoping to provide many insights into creating powerful Excel based solutions. Check out his LED RSS News Ticker at his blog for an interesting demonstration of bitmasking in Excel worksheet formulas.</em></p>
<div class="dotline"></div>
<p><span id="25012010_2"></span><br />
Here&#8217;s some basic information on VBScript.</p>
<h2>What is a .VBS File ?</h2>
<p>Simply put, a .vbs file is essentially a file containing VBScript code (short for <strong>Visual Basic Scripting Edition</strong>). VBScript comes installed with all Windows OS since 1998. What make .vbs useful is its abiity to pack html and VBScript code in a single file which can then be stored as a file with &#8220;<strong>.vbs</strong>&#8221; extension.</p>
<p>Here&#8217;s an example. Open notepad and type in the following lines:</p>
<div class="codecolorer-container vb mac-classic" style="overflow:auto;white-space:nowrap;width:535px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="vb codecolorer" style="font-family:Monaco,Lucida Console,monospace">MsgBox(&quot;Hello World&quot;)</div></td></tr></tbody></table></div>
<p>I am sure you would have recognized that this is a pretty standard VBA code that anyone would use when writing VBA code. Now save this file as &#8220;<em>myfile.vbs</em>&#8220;. Now double click on the file and you will see the message box appear with the specified text. When used judiciously, VBScript allows access the DOM (Document Object Model) of a web page and to carry out operations not possible using plain HTML.</p>
<h2>Where Does VBScript Get Used</h2>
<p>It can be imbedded in an HTML webpage as a sort of analog to JavaScript. Microsoft developed Internet Explorer early on to use VBScript natively for essentially any task that a website developer might do in JavaScript, such as AJAX, animation, etc. The only problem with using VBScript inside of a webpage to control that page is that the only browser that supports it is Internet Explorer; all other browsers will just ignore the VBScript. In this scenario, VBScript is being interpreted and run by Internet Explorer.</p>
<p>The second major use is as the native language used in Active Server Pages (ASP), which was Microsoft’s first server-side script engine for dynamically-generated web pages. Entire web applications can be developed using ASP Classic and VBScript, and millions have been. In this scenario, VBScript is being interpreted and run by Internet Information Services (IIS), Microsoft’s web server.</p>
<p>The third major use, and the scenario used in this article, to run VBScript in the Windows OS subsystem called the Windows Scripting Host. In effect, this allows VBScript to act as a modern day batch file on steroids. IT administrators often use VBScript to automate management of company workstations, including the company-wide deployment of updates and new programs, backups, diagnostics, etc. In this scenario, VBScript is being interpreted and run by the Windows Scripting Host on any modern Windows computer.</p>
<p>VBScript is a subset of VB6 and VBA. One important difference is that VBScript does not support variable typing, so all variables in VBScript are variants.</p>
<p>Click here to go <a href="http://www.databison.com/index.php/multithreaded-vba-an-approach-to-processing-using-vbscript/#25012010_1"><b>back to the article</b></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/multithreaded-vba-an-approach-to-processing-using-vbscript/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Named Range &#8211; A Few Quickies</title>
		<link>http://www.databison.com/index.php/named-range-a-few-quickies/</link>
		<comments>http://www.databison.com/index.php/named-range-a-few-quickies/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 08:04:42 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[excel tips]]></category>
		<category><![CDATA[named range]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4216</guid>
		<description><![CDATA[Named Ranges are probably one of the most useful features in Excel. Named ranges can add interactivity, make long formulas shorter and and if used properly, generally provide a clean mechanism to share information across the workbook. I remember being mighty impressed with Peter Rakos 3D rotation model last year and spent a good amount [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Named Ranges</strong> are probably one of the most useful features in Excel. Named ranges can add interactivity, make long formulas shorter and and if used properly, generally provide a clean mechanism to share information across the workbook. I remember being mighty impressed with <a href="http://www.gamasutra.com/view/feature/3563/microsoft_excel_revolutionary_3d_.php?print=1"><b>Peter Rakos</b></a>  3D rotation model last year and spent a good amount of time trying to understand it. The VBA code is only a few lines with the major work being taken up by the named ranges. (<a href="http://www.databison.com/wp-content/uploads/2008/09/OGAL_demo.zip"><b>Take a look at the modified version of the file here</b></a>). Considering how useful named ranges are to mankind (especially the ones who work out of cubicles), I am a little surprised that they have gone without getting much focus on this blog. However today changes that.</p>
<p>So here are some tips that will make working with named ranges in excel faster and more productive.</p>
<h2>Creating Multiple Named Ranges in One Go using a Shortcut</h2>
<p>Normally if one has to create multiple <strong>named ranges</strong> from a given set of data, the usual course of action is to type in (or select) the address of a named range and then create one after providing it a proper name. However, in many cases where you already have the data headers present in a worksheet, there&#8217;s a far simpler option available to create multiple named ranges in one go.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/create-named-range-selection.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/create-named-range-selection.png" alt="create-named-range-selection" title="create-named-range-selection" width="445" height="113" class="alignnone size-full wp-image-4221" /></a></p>
<p>Say for example, we had a set of data points arranged as shown below and we wanted to create four separate named ranges, one for each column. Rather than creating named ranges one by one, you can choose to use the <strong>CTRL + SHIFT + F3</strong> shortcut which opens up the &#8216;Create Named Range From Selection&#8217; option box. The same can be accessed from the under the &#8216;Formulas&#8217; tab as shown above. You can now create more than one named range &#8211; rowwise, columnwise or both.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/shortcut-to-create-multiple-named-range.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/shortcut-to-create-multiple-named-range.png" alt="shortcut-to-create-multiple-named-range" title="shortcut-to-create-multiple-named-range" class="alignnone size-full wp-image-4219" /></a></p>
<p>When you click ok, you can go back and see that four separate named ranges have been created. The column headers are used as names for the named range so created. If needed, you can now go back to the named range namager and quickly edit the addresses.</p>
<h2>Accessing the Named Range Manager in Excel</h2>
<p>While Excel 2003 used &#8216;Insert&#8217; -> &#8216;Name&#8217; -> &#8216;Define&#8217; to access this option, Excel 2007 + had &#8216;Formulas&#8217; -> &#8216;Name Manager&#8217;. Another way is to use <strong>CTRL + F3</strong>.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/named-range-manager.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/named-range-manager.png" alt="named-range-manager" title="named-range-manager" width="410" height="250" class="alignnone size-full wp-image-4217" /></a></p>
<h2>Using the OFFSET Function</h2>
<p>Named ranges would not be half as interesting (and useful) without the <a href="http://www.databison.com/index.php/excel-offset-function/"><b>OFFSET function</b></a>. Offset helps positiion and expand a given range. When used as a part of a named range, the result can be potent dynamic range which has the ability to expand, contract or reposition itself. </p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/using-offset-function-with-named-range.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/using-offset-function-with-named-range.png" alt="using-offset-function-with-named-range" title="using-offset-function-with-named-range" width="410" height="190" class="alignnone size-full wp-image-4223" /></a></p>
<h2>Use Absolute Reference When Working with Named Ranges</h2>
<p>To be honest, I don&#8217;t know if this is a design feature or a bug but if you use relative reference (A1 insted of $A$1) when defining a named range, it does not stay that way you intended it for long. Let me highlight this with an example. Suppose you wanted to create a named range which OFFSETS cell A1 10 rows downwards. The usual thing to do is to write something like:</p>
<p><strong>=OFFSET(Sheet1!A1,10,0)</strong></p>
<p>or as shown below:</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/named-range-glitch-1.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/named-range-glitch-1.png" alt="named-range-glitch-1" title="named-range-glitch-1" width="410" height="250" class="alignnone size-full wp-image-4225" /></a></p>
<p>So far so good. If you had to use this named range in a cell, you would probably pick up a cell (say B1) and enter something similar to <strong>= my_named_range </strong></p>
<p>where my_named_range is the name that you gave to the named range you create in the previous step.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/using-named-range-in-a-cell.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/using-named-range-in-a-cell.png" alt="using-named-range-in-a-cell" title="using-named-range-in-a-cell" width="350" height="332" class="alignnone size-full wp-image-4235" /></a></p>
<p>Now let&#8217;s do some random activities &#8211; copy paste cells, draw a chart etc etc. Now go back and revisit the named range (remember to use CTRL + F3). What do you see? The named range has &#8216;magically&#8217; changed from <strong>=OFFSET(Sheet1!A1,10,0)</strong> (the formula that you had entered) to <strong>=OFFSET(Sheet1!A2,10,0)</strong> (or randomly in other cases to something like <strong>=OFFSET(Sheet1!A65536,10,0)</strong>). The cell where you entered the named range (cell B1 in our case), still continues to show the correct value but may error out at a later stage.</p>
<p>On the other hand, if one had used absolute reference ($A$1 insted of A1), the named range stays put.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/named-range-glitch-2.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/named-range-glitch-2.png" alt="named-range-glitch-2" title="named-range-glitch-2" width="410" height="250" class="alignnone size-full wp-image-4226" /></a></p>
<p>I once overlooked this phenomenon when working with P&#038;L projections and you should have seen the look on people&#8217;s faces when they opened the spreadsheet <img src='http://www.databison.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h2>Use F2 to Edit a Named Range</h2>
<p>Another useful thing to keep in mind to use F2 when editing named ranges. Try using the arrow key to navigate across a named range formula and see what fine mess happens! </p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/arrow-key-in-a-named-range.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/arrow-key-in-a-named-range.png" alt="arrow-key-in-a-named-range" title="arrow-key-in-a-named-range" width="410" height="250" class="alignnone size-full wp-image-4228" /></a></p>
<p>Pressing F2 before you use the arrow keys prevents this from happening.</p>
<p></p>
<p>Have got any named range tricks of your own? Care to share?</p>
<p>Here&#8217;s an example of <a href="http://www.databison.com/wp-content/uploads/2008/09/validation.xls"><b>named range with data validation</b></a>. You can also download it by clicking on the button below:<br />
<a href="http://www.databison.com/wp-content/uploads/2008/09/validation.xls"><br /><img src="http://www.databison.com/wp-content/uploads/2009/06/download.png" alt="data validation download" title="data validation download" width="240" height="60" class="alignnone size-full wp-image-1658" /><br /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/named-range-a-few-quickies/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>So How Many Of These Excel Shortcuts Do You Know, Punk ?</title>
		<link>http://www.databison.com/index.php/so-how-many-of-these-excel-shortcuts-do-you-know-punk/</link>
		<comments>http://www.databison.com/index.php/so-how-many-of-these-excel-shortcuts-do-you-know-punk/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 06:39:47 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[excel tips]]></category>
		<category><![CDATA[excel shortcuts]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4176</guid>
		<description><![CDATA[So you thought you knew every goddam&#8217; Excel shortcut out there? Thought that you were the quickest draw around the office block. Not so fast sunny boy &#8230; not so fast ! You&#8217;ve just ventured into the mean and vicious badlands of the Bison. You have two choices &#8211; stop reading this here &#8230; &#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>So you thought you knew every goddam&#8217; Excel shortcut out there? Thought that <strong>you</strong> were the quickest draw around the office block. Not so fast sunny boy &#8230; not so fast ! You&#8217;ve just ventured into the mean and vicious badlands of the Bison.</p>
<p>You have two choices &#8211; <strong>stop reading this here</strong> &#8230;<br />
&#8230; OR<br />
&#8230; stay back and <strong>take up the challenge</strong> &#8230;.</p>
<p>So before I have your ego blown off, I will give you 7 chances to salvage it.</p>
<h2>Excel Shortcut to Copy Contents of Cell onto Cells Below It</h2>
<p>So how do you copy the contents of a given cell onto the cells below it?</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/excel-shortcut-to-copy-cell-and-fill-down.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/excel-shortcut-to-copy-cell-and-fill-down.png" alt="excel-shortcut-to-copy-cell-and-fill-down" title="excel-shortcut-to-copy-cell-and-fill-down" class="alignnone size-full wp-image-4183" /></a></p>
<p>I know what you are thinking &#8211; something like CTRL + C, then select the range using the SHIFT key and then CTRL + V. Right? Not quite.</p>
<p>Simply select the (vertical) range in which the first cell is the one you would like to copy down. Press <strong>CTRL + D</strong>.</p>
<h2>Excel Shortcut to Enter a New Value into a Cell and Copy To Others</h2>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/excel-shortcut-to-enter-a-new-value-and-copy-to-range.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/excel-shortcut-to-enter-a-new-value-and-copy-to-range.png" alt="excel-shortcut-to-enter-a-new-value-and-copy-to-range" title="excel-shortcut-to-enter-a-new-value-and-copy-to-range" class="alignnone size-full wp-image-4184" /></a></p>
<p>You have been sent over a partially filled worksheet with some data which unfortunately has some blank cells in it. From your experience you know some of the values and would like to quickly punch in those values and be done with it as fast as possible.</p>
<p>Stop right there!!! No entering a value and then copy pasting it over a range is not the quickest way around. Simply select the entire range (even a two dimensional one) and in the first <a href="http://www.databison.com/index.php/cell-formula-in-excel-how-to-use-cell-formula-and-examples/"><b>cell</b></a>, type in the value you would like to copy to all cells of the range. Press <strong>CTRL + ENTER</strong>.</p>
<h2>Excel Shortcut To Hide All Objects (Including Charts) in the Worksheet</h2>
<p>You finally managed to get that dashboard done with a gazillion charts and shapes. However you would like to rework the formulas and formatting. So there go another few hours in moving the charts and other shapes (one by one) around the spreadsheet and then editing the formulas underneath (you were smart, you hid the formulas under a chart so that nobody could see it <img src='http://www.databison.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> ). So anything you can do about it?</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/excel-shortcut-to-hide-objects-in-a-worksheet.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/excel-shortcut-to-hide-objects-in-a-worksheet.png" alt="excel-shortcut-to-hide-objects-in-a-worksheet" title="excel-shortcut-to-hide-objects-in-a-worksheet" class="alignnone size-full wp-image-4186" /></a></p>
<p>Simple. <strong>Press CTRL + 6</strong> to hide all the objects and work directly with the cells underneath those objects. How do you turn them right back on. Simple again. Press CTRL + 6.</p>
<h2>Excel Shortcut to Format as Date</h2>
<p>You imported a ton of data from Oracle or MS-SQL or one of those wired applications that the IT people in your organization use nowadays. The morons sent you the data fine but the date columns come out having values something like 40179, 40180 etc. How do you convert them to date.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/excel-shortcut-to-conver-number-to-date.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/excel-shortcut-to-conver-number-to-date.png" alt="excel-shortcut-to-conver-number-to-date" title="excel-shortcut-to-conver-number-to-date" width="490" height="203" class="alignnone size-full wp-image-4192" /></a></p>
<p>I know what you are thinking. You are thinking, hey that&#8217;s simple &#8211; Select the column, then right click and open the &#8216;Format Cell&#8217; option and then format them as dates.</p>
<p>Here&#8217;s the better option &#8211; Press <strong>CTRL + SHIFT + #</strong>. That does it. One can also use :<br />
<strong>Ctrl + Shift + $</strong> to convert a value to currency and<br />
<strong>Ctrl + Shift + %</strong> to convert to percent format.</p>
<h2>Excel Shortcuts to Change Font Family and Font Size</h2>
<p>You have a sentimental attachment to Calibri. You use Calibri when you draft your emails, use them in all your spreadsheets and even say goodnight to your wife in Calibri <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  But that newly recruited analyst has an equally strong affinity for Arial. (He comes from the Arial gene pool). As a result, you spend a good amount of your time converting your spreadsheets to Calibri from Arial.</p>
<p>Any shortcuts you remember? Well I have one. Use <strong>CTRL + SHIFT + F</strong>. That opens up the Font family format option box. Another shortcut that works only with Excel 2003 is <strong>CTRL + SHIFT + P</strong> which let&#8217;s you change the font size (increase / decrease using the arrow key). While at it, any shortcuts to change the fill color of the cell? Again use <strong>CTRL + 1</strong> to open the format cell option box and then (after releasing all keys) press &#8216;F&#8217; (or &#8216;P&#8217; if you&#8217;re using Excel 2003).</p>
<h2>Excel Shortcuts to Draw Borders around Cells</h2>
<p>Think what if I asked you to draw a border around a cell.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/excel-shortcut-to-draw-borders-around-cell.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/excel-shortcut-to-draw-borders-around-cell.png" alt="excel-shortcut-to-draw-borders-around-cell" title="excel-shortcut-to-draw-borders-around-cell" width="490" height="203" class="alignnone size-full wp-image-4193" /></a></p>
<p>1. You take your hand off the keyboard.<br />
2. Place it firmly on the mouse and then aim it precisely over the draw border <a href="http://www.databison.com/wp-content/uploads/2010/01/draw-border.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/draw-border.png" alt="draw-border" title="draw-border" width="34" height="24" class="alignright size-full wp-image-4194" /></a> option.<br />
3. Take another split second choosing the correct border option and then press the trigger.</p>
<p>And that&#8217;s it. Yup you got me there. Fast. Neat work.</p>
<p>Not quite. I would use <strong>CTRL + SHIFT + &#038;</strong>. Go back and check your spreadsheet, I just made two more smoking holes in it <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h2>Excel Shortcut to Add Comment or Edit It</h2>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/excel-comment.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/excel-comment.png" alt="excel-comment" title="excel-comment" width="415" height="176" class="alignnone size-full wp-image-4201" /></a></p>
<p>This one &#8211; this one right here is a single handed trick (and a dirty left handed one at that). How  do you enter a comment (or edit an existing one) in a spreadsheet? Before you say &#8211; Right click and Add / Edit Comment &#8211; Zip it. Pressing <strong>SHIFT + F2</strong> does it as well. Works for both editing an existing one as well as adding a new comment.</p>
<div class="clear"></div>
<p></p>
<p>Good that you made it this far cause I sure am done with this post.<br />
I know what you&#8217;re asking yourself: <strong>Do I feel lucky.</strong></p>
<p>Well, do ya, punk?</p>
<p><em>(In case you didn&#8217;t catch it, the dialog adaptation was from &#8220;Dirty Harry&#8221;, Released: 1971)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/so-how-many-of-these-excel-shortcuts-do-you-know-punk/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Volatility Chart in Excel &#8211; Lessons in Chart Design From NY Times</title>
		<link>http://www.databison.com/index.php/volatility-chart-in-excel-lessons-in-chart-design-from-ny-times/</link>
		<comments>http://www.databison.com/index.php/volatility-chart-in-excel-lessons-in-chart-design-from-ny-times/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 06:56:43 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[excel chart]]></category>
		<category><![CDATA[financial markets]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4120</guid>
		<description><![CDATA[Here&#8217;s a slightly dated chart from NY Times showing volatility on the Wall St across the century. The chart does commendable work in conveying information about a longish time series pretty effectively. I found some great chart design principles at work here that I could utilize for day to day charting needs. (Click on image [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a slightly dated chart from NY Times showing volatility on the Wall St across the century. The chart does commendable work in conveying information about a longish time series pretty effectively. I found some great chart design principles at work here that I could utilize for day to day charting needs.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/volatility-chart.jpg"><img src="http://www.databison.com/wp-content/uploads/2010/01/volatility-chart-small.png" alt="volatility-chart-small" title="volatility-chart-small" class="alignnone size-full wp-image-4134" /></a></p>
<p>(<strong>Click on image</strong> to open larger version. Click <a href="http://graphics8.nytimes.com/images/2008/01/05/business/20080105_SOAPBOX-GRAPHIC.jpg">here</a> for the original version)</p>
<p>Here&#8217;s a look at a few of those amazing things that I picked up from this chart (I am sure when you take a closer look, you will find more). I will also attempt to show how they can be reproduced using Excel.</p>
<h2>The Chart Ought to be Clutter Free</h2>
<p>The first time you look at the chart, one could probably miss the fact that you are looking at about 100 years worth of data. Everything about the chart characterizes simplification. <strong>&#8220;Above all else, simplify&#8221;</strong>.</p>
<p>Here&#8217;s the Excel reproduction of the NY Times chart. Please bear in mind that I&#8217;ve stripped off a few details, the data is random and the chart isn&#8217;t as handsome as the original <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/volatility-chart-in-excel.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/volatility-chart-in-excel.png" alt="volatility-chart-in-excel" title="volatility-chart-in-excel" class="alignnone size-full wp-image-4129" /></a></p>
<h2>Softer Gridlines &#8211; To Avoid Chartjunk</h2>
<p>Since the chart covers a long timeline, the gridlines help to break-up the time series into smaller, more digestible pieces. The authors have taken care to keen them subtle and in the background using softer colors.</p>
<p>In Excel, you can make the gridlines a little more subtle by first modifying the default palette colors and then using them to paint the gridlines.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/color-gridlines-in-excel-chart.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/color-gridlines-in-excel-chart.png" alt="color-gridlines-in-excel-chart" title="color-gridlines-in-excel-chart" class="alignnone size-full wp-image-4124" /></a></p>
<h2>X-Axis Labels in Proportion to the Overall Timeframe Covered</h2>
<p>Oftentimes, when one has too many data points in the chart, the X-axis suffers with data overload. One often sees too many being forced to occupy the same space. This is 100 years of data and all the chart makers have used are 11 X-Axis labels. The result &#8211; more clarity.</p>
<p>In Excel you can add <a href="http://www.databison.com/index.php/custom-format-in-excel-how-to-format-numbers-and-text/"><b>custom format</b></a> the chart&#8217;s axis so that they become easier to grasp for the reader. Here&#8217;s how we converted something like &#8220;<strong>1-Jan-1910</strong>&#8221; into &#8220;<strong>1910&#8242;s</strong>&#8220;.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/format-x-axis-labels.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/format-x-axis-labels.png" alt="format-x-axis-labels" title="format-x-axis-labels" class="alignnone size-full wp-image-4127" /></a></p>
<p>(<strong>Note</strong>: The label&#8217;s on the recreated chart are not perfect (say a 1980&#8242;s does not span the range between 1980 and 1990 but actually marks the year 1980). There are ways to get this right but are beyond the scope of this post.)</p>
<h2>Y-Axis Labels Formatted to Ease Comprehension</h2>
<p>I&#8217;ve been guilty of leaving the labels on the Y-Axis as such without providing the reader with any information on the unit of measurement. A point on the scale which reads &#8220;10&#8243; could be anything &#8211; 10 years, 10 litres, 10 tons, 10 billion. How many times have you seen people ask the following question in a presentation,</p>
<p>&#8220;<em>So the units on the Y-Axis represent (something) , <strong>right?</strong></em>&#8221;</p>
<p>I have been asked that question more times than I would wish to remember and I kick myself in the &#8230; you know what &#8230; everytime for missing the obvious.</p>
<p>In this case, the labels have been formatted with a <strong>%</strong> suffix so that one does not have to ask that question. The datum (zero) has been omitted. The same can be achieved in Excel by again using custom formatting. This time around, we take use of three conditions &#8211; the format to use when the number is positive, the format to use when negative and the third one for zero. (In case you missed the link above, here&#8217;s a bit of information on the <a href="http://www.databison.com/index.php/custom-format-in-excel-how-to-format-numbers-and-text/"><b>custom format</b></a> feature in Excel.)</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/format-chart-y-axis-label.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/format-chart-y-axis-label.png" alt="format-chart-y-axis-label" title="format-chart-y-axis-label" class="alignnone size-full wp-image-4128" /></a></p>
<h2>Add Descriptive Information &#8211; But Don&#8217;t Overdo</h2>
<p>I like to pack my charts with as much descriptive information as possible till such time that they don&#8217;t interfere with comprehension and readibility. Most of the charts that you see in the corporate world are not exactly as small as <a href="http://www.databison.com/index.php/sparklines-in-excel-new-features-in-excel-2010-series/"><b>sparklines</b></a>. This means that a typical chart will have a lot of space that can be used for other things &#8211; such as the empty region underneath an area or a line chart. In this case, the empty space below the plot has been used effectively by adding major events descriptions there. Also worth noting is that the minor events have been left out. I think a few other pivotal events could have been included but <strong>that&#8217;s the point</strong> &#8211; you can&#8217;t make everybody like what they see. Be bold &#8211; don&#8217;t give in the urge to show everything.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/add-descriptive-information.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/add-descriptive-information.png" alt="add-descriptive-information" title="add-descriptive-information" class="alignnone size-full wp-image-4126" /></a></p>
<p>You would have also probably noticed that the legend is shown right next to the chart label so that nobody misses it.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/legend-in-chart.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/legend-in-chart.png" alt="legend-in-chart" title="legend-in-chart" class="alignnone size-full wp-image-4125" /></a></p>
<h2>Avoid Colors Unless They Convey Information</h2>
<p>Use colors to show additional information, preferably another dimension of data. Be subtle and be intuitive. <a href="http://www.perceptualedge.com/articles/visual_business_intelligence/rules_for_using_color.pdf">Stephan Few</a> has some great thoughts on using colors with charts here.</p>
<p>The color range from dark blue to pale brown signifies the return from the index (-25% to +25%). As you would have sensed, periods of low return are typically followed by periods of high volatility.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/volatity-and-returns.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/volatity-and-returns.png" alt="volatity-and-returns" title="volatity-and-returns" class="alignnone size-full wp-image-4140" /></a></p>
<p>Like everything else in Excel, there will be a way to add the color phase band to this chart but I leave that challenge to you <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Here&#8217;s a copy of the reproduced <a href="http://www.databison.com/wp-content/uploads/2010/01/volatility-chart.xls"><b>volatility chart for download</b></a></p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/volatility-chart.xls"><img src="http://www.databison.com/wp-content/uploads/2009/06/download.png" alt="volatility-chart" title="volatility-chart" width="240" height="60" class="alignnone size-full wp-image-1658" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/volatility-chart-in-excel-lessons-in-chart-design-from-ny-times/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>An Excel Chart&#8217;s Journey Across Versions</title>
		<link>http://www.databison.com/index.php/an-excel-charts-journey-across-versions/</link>
		<comments>http://www.databison.com/index.php/an-excel-charts-journey-across-versions/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 04:45:47 +0000</pubDate>
		<dc:creator>Ajay</dc:creator>
				<category><![CDATA[excel 2010]]></category>
		<category><![CDATA[excel chart]]></category>

		<guid isPermaLink="false">http://www.databison.com/?p=4081</guid>
		<description><![CDATA[Sometime back I wrote a post on making control charts using Excel. The chart was initially created in Excel 2003. The chart consisted of the plot values, the average line and upper &#038; lower control limits. While the main data series was a line chart, the average, upper and lower control limits were plotted as [...]]]></description>
			<content:encoded><![CDATA[<p>Sometime back I wrote a post on <a href="http://www.databison.com/index.php/control-chart-in-excel/"><b>making control charts using Excel</b></a>. The chart was initially created in Excel 2003. The chart consisted of the plot values, the average line and upper &#038; lower control limits. While the main data series was a line chart, the average, upper and lower control limits were plotted as dots of an X-Y and then were extended into lines using the horizontal error bars. Shown below is a sample.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/control-chart-sample.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/control-chart-sample.png" alt="" title="control-chart-sample" width="494" height="294" class="alignnone size-full wp-image-4082" /></a></p>
<p>The main data series referred to a range in the sheet.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/control-chart-main-data-series.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/control-chart-main-data-series.png" alt="control-chart-main-data-series" title="control-chart-main-data-series" width="385" height="152" class="alignnone size-full wp-image-4083" /></a></p>
<p>The average, upper and lower control limits were dynamic in nature and named ranges were used to provide them with values.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/control-chart-named-range.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/control-chart-named-range.png" alt="control-chart-named-range" title="control-chart-named-range" width="390" height="161" class="alignnone size-full wp-image-4084" /></a></p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/control-chart-named-range-reference.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/control-chart-named-range-reference.png" alt="control-chart-named-range-reference" title="control-chart-named-range-reference" width="410" height="250" class="alignnone size-full wp-image-4085" /></a></p>
<h2>From Excel 2003 to Excel 2007</h2>
<p>Coming to the point &#8211; All was hunk dory when I made this in Excel 2003. Then someone pointed it out that the charts did not come out looking all that great in Excel 2007.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/control-chart-in-excel-2007.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/control-chart-in-excel-2007.png" alt="control-chart-in-excel-2007" title="control-chart-in-excel-2007" class="alignnone size-full wp-image-4086" /></a></p>
<p>On closer inspection, I found that the disproportionately large error values that were used to create the error bars were causing this errant behavior . I had, in all my enthusiasm to make the chart &#8216;future-proof&#8217; had provided an error value of 1000.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/xy-error-amount.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/xy-error-amount.png" alt="xy-error-amount" title="xy-error-amount" width="295" height="150" class="alignnone size-full wp-image-4087" /></a></p>
<p>While that worked well in Excel 2003, it make a caricature of a well meaning chart in Excel 2007. Since the chart&#8217;s plot area remained the same, the actual data values (some 42 data points) got squeezed into a proportionately smaller area compared to the 1000 assigned as the error value. The result was that it appeared as if all the actual data points had been aligned to vertical axis !</p>
<p>This was easy to fix however, and when I changed the error values back to 42 (equal to the number of data points) from an earlier value of 1000, the chart regained sanity.</p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/control-chart-back-to-normal.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/control-chart-back-to-normal.png" alt="control-chart-back-to-normal" title="control-chart-back-to-normal" width="483" height="283" class="alignnone size-full wp-image-4088" /></a></p>
<h2>From Excel 2007 to Excel 2010</h2>
<p><strong>Note : </strong> Please see update below.</p>
<p><del datetime="2010-01-29T19:27:59+00:00">Guess how the chart we rectified for Excel 2007 turned out in Excel 2010 (beta). Here&#8217;s how:</del></p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/control-chart-in-excel-2010.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/control-chart-in-excel-2010.png" alt="control-chart-in-excel-2010" title="control-chart-in-excel-2010" width="497" height="254" class="alignnone size-full wp-image-4089" /></a></p>
<p><del datetime="2010-01-29T19:27:59+00:00">The average, upper and lower control limit lines were all gone. Actually they were there but hidden. I could get them back on changing the visual layout of the chart.</del></p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/change-chart-layout.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/change-chart-layout.png" alt="change-chart-layout" title="change-chart-layout" width="397" height="102" class="alignnone size-full wp-image-4090" /></a></p>
<p><del datetime="2010-01-29T19:27:59+00:00">That got us to this point.</del></p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/rectified-control-chart-in-excel-2010.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/rectified-control-chart-in-excel-2010.png" alt="rectified-control-chart-in-excel-2010" title="rectified-control-chart-in-excel-2010" class="alignnone size-full wp-image-4100" /></a></p>
<p><del datetime="2010-01-29T19:27:59+00:00">But the formatting was gone! There isn&#8217;t chance in hell that someone would be able to tell the upper and lower control limits from the gridlines.</del></p>
<p><del datetime="2010-01-29T19:21:13+00:00">I noticed another thing that I really could not fathom. While the spreadsheet that we had originally created in Excel 2003, atleast opened up correctly in Excel 2007, when I tried opening it in Excel 2010, the row heights for the rows (where the control chart had been placed) had somehow increased all the way from the default 12.75 pixels in Excel 2003 to something like 409 pixels in Excel 2010). (Apparently the same treatment is meted out to a few <a href="http://www.databison.com/index.php/square-bubble-heatmap-chart/"><b>other charts</b></a> as well.)</del></p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/bad-chart-excel-2010.png"><img src="http://www.databison.com/wp-content/uploads/2010/01/bad-chart-excel-2010.png" alt="bad-chart-excel-2010" title="bad-chart-excel-2010" width="435" height="280" class="alignnone size-full wp-image-4098" /></a></p>
<p><del datetime="2010-01-29T19:21:13+00:00">The result &#8211; dashboards crapped out to the max <img src='http://www.databison.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </del></p>
<p><a href="http://www.databison.com/wp-content/uploads/2010/01/crap.jpg"><img src="http://www.databison.com/wp-content/uploads/2010/01/crap.jpg" alt="crap" title="crap" width="446" height="353" class="alignnone size-full wp-image-4095" /></a><br />
<em>Courtesy:<a href=" http://icanhascheezburger.com/2009/12/31/around-the-interwebs-7/">www.icanhascheezburger.com</a></em></p>
<p>Here&#8217;s the culprit duly zipped and handcuffed. If you try opening it first with Excel 2003, followed by Excel 2007 and then finally with Excel 2010, you would see what I mean.<br />
<a href="http://www.databison.com/wp-content/uploads/2010/01/control-chart-across-excel-versions.zip"><br /><img src="http://www.databison.com/wp-content/uploads/2009/06/download.png" alt="control-chart-across-excel-versions" title="control-chart-across-excel-versions" width="240" height="60" class="alignnone size-full wp-image-1658" /></a></p>
<div class="dotline"></div>
<p><em><strong>Update</strong>: Tell you what &#8230; Microsoft wrote back confirming that the issues have been addressed in the latest builds. So much for saying that the MS doesn&#8217;t listen &#8230; well they did this time <img src='http://www.databison.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.databison.com/index.php/an-excel-charts-journey-across-versions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
