<?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>Peltier Tech Blog &#187; Data Techniques</title>
	<atom:link href="http://peltiertech.com/WordPress/category/data-techniques/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress</link>
	<description>Peltier Tech Excel Charts and Programming Blog</description>
	<lastBuildDate>Tue, 31 Aug 2010 07:00:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Copy a Pivot Table and Pivot Chart and Link to New Data</title>
		<link>http://peltiertech.com/WordPress/copy-pivot-table-pivot-chart-link-to-new-data/</link>
		<comments>http://peltiertech.com/WordPress/copy-pivot-table-pivot-chart-link-to-new-data/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 07:00:14 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=3212</guid>
		<description><![CDATA[A very common task you may have is to take a chart you&#8217;ve painstakingly formatted and use it with new data. I described a few ways to handle this in Make a Copied Chart Link to New Data.
Most commonly you have a worksheet with a bunch of data and a corresponding chart, and you have [...]]]></description>
			<content:encoded><![CDATA[<p>A very common task you may have is to take a chart you&#8217;ve painstakingly formatted and use it with new data. I described a few ways to handle this in <a href="http://peltiertech.com/WordPress/make-a-copied-chart-link-to-new-data/"title="Make a Copied Chart Link to New Data | Peltier Tech Blog | Excel Charts" >Make a Copied Chart Link to New Data</a>.</p>
<p>Most commonly you have a worksheet with a bunch of data and a corresponding chart, and you have another sheet of data you want to add a chart to. Copying and pasting the chart onto the new sheet requires you to change links in the chart, usually series by series. This is tedious and error-prone. But the article above describes an easier way:</p>
<ol style="margin-left: 24pt;">
<li>Make a copy of the worksheet with the old data and chart;</li>
<li>Copy the new data;</li>
<li>Paste the new data over the old data on the copied worksheet.</li>
</ol>
<p><span id="more-3212"></span>The chart on the new worksheet updates as soon as the new data is pasted into place. Works in Excel 2003 and earlier, and in Excel 2007 if you&#8217;ve installed the latest service packs.</p>
<p>What if the worksheet contains a pivot table and its sister pivot chart? Well, knowing the above protocol, you&#8217;d think you could copy the worksheet, change the data, and the chart would be fine. And in Excel 2003 this set of steps works great:</p>
<ol style="margin-left: 24pt;">
<li>Make a copy of the worksheet with the old pivot table and pivot chart;</li>
<li>Change the pivot table&#8217;s data source to the new range;</li>
<li>Refresh the pivot table.</li>
</ol>
<p>The new pivot chart (on the copied sheet) retains its link to the pivot table on its parent worksheet, so it updates as soon as the pivot table is refreshed.</p>
<p>But in Excel 2007, these steps  don&#8217;t work the same way. When you copy the worksheet with the pivot table and chart, not only does the new pivot table link to the same old data, the new chart also links to the old pivot table. You can easily enough change the data source of the new pivot table to the appropriate range; in fact, this is easier to do in Excel 2007 than in earlier versions. But the new chart cannot be linked to the new pivot table. It is permanently linked to the old pivot table.</p>
<p>My colleague Bill Manville wrote to me about this problem, citing an old forum post in which I doubted this could ever be solved. I&#8217;m glad to say that Bill has proved me wrong. He sent me a new protocol that makes this work.</p>
<ol style="margin-left: 24pt;">
<li>Make a copy of the worksheet with the old pivot table and pivot chart <em>in a different workbook</em>;</li>
<li>Move the copied worksheet back into the original workbook;</li>
<li>Change the new chart&#8217;s source data to the new pivot table;</li>
<li>Change the pivot table&#8217;s data source to the new range;</li>
<li>Refresh the pivot table.</li>
</ol>
<p>The difference is that the worksheet is copied into a new workbook (or another existing workbook) rather than within the original workbook. When this happens, the pivot table still links to the original data, but the chart becomes unlinked from the pivot table. In fact, the chart changes back from a pivot chart to a regular chart. It is unlinked from any data range, and the series formulas have been converted to written-out arrays.</p>
<p>Since the chart has been unlinked in the process, it now can be relinked. Thanks, Bill, for saving us lots of time and effort.</p>
<p>Bill tells me that the familiar Excel 2003 behavior has been restored to Excel 2010.</p>
<p>Peltier Technical Services, Inc., Copyright © 2010.<br /> <br /><span style="font: 80% Verdana,Tahoma,Arial,sans-serif;">Licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow" rel="license" >Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.<br /> <br />
<a href="http://www.exceluser.com/cmd.asp?Clk=1374689" rel="nofollow" ><IMG SRC="http://www.exceluser.com/images/info/pub/info_dash_c02.gif" ALT="Learn how to create Excel dashboards." WIDTH="468" HEIGHT="60" border=0></a><br />
<br /><img src="http://www.exceluser.com/cmd.asp?Imp=1374689" width="0" height="0" border="0"></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://twitter.com/home?status=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F&amp;title=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data&amp;bodytext=A%20very%20common%20task%20you%20may%20have%20is%20to%20take%20a%20chart%20you%27ve%20painstakingly%20formatted%20and%20use%20it%20with%20new%20data.%20I%20described%20a%20few%20ways%20to%20handle%20this%20in%20Make%20a%20Copied%20Chart%20Link%20to%20New%20Data.%0D%0A%0D%0AMost%20commonly%20you%20have%20a%20worksheet%20with%20a%20bunch%20of%20data%20and%20" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F&amp;t=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F&amp;title=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data&amp;source=Peltier+Tech+Blog+Peltier+Tech+Excel+Charts+and+Programming+Blog&amp;summary=A%20very%20common%20task%20you%20may%20have%20is%20to%20take%20a%20chart%20you%27ve%20painstakingly%20formatted%20and%20use%20it%20with%20new%20data.%20I%20described%20a%20few%20ways%20to%20handle%20this%20in%20Make%20a%20Copied%20Chart%20Link%20to%20New%20Data.%0D%0A%0D%0AMost%20commonly%20you%20have%20a%20worksheet%20with%20a%20bunch%20of%20data%20and%20" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F&amp;title=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data&amp;notes=A%20very%20common%20task%20you%20may%20have%20is%20to%20take%20a%20chart%20you%27ve%20painstakingly%20formatted%20and%20use%20it%20with%20new%20data.%20I%20described%20a%20few%20ways%20to%20handle%20this%20in%20Make%20a%20Copied%20Chart%20Link%20to%20New%20Data.%0D%0A%0D%0AMost%20commonly%20you%20have%20a%20worksheet%20with%20a%20bunch%20of%20data%20and%20" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F&amp;title=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F&amp;title=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data&amp;annotation=A%20very%20common%20task%20you%20may%20have%20is%20to%20take%20a%20chart%20you%27ve%20painstakingly%20formatted%20and%20use%20it%20with%20new%20data.%20I%20described%20a%20few%20ways%20to%20handle%20this%20in%20Make%20a%20Copied%20Chart%20Link%20to%20New%20Data.%0D%0A%0D%0AMost%20commonly%20you%20have%20a%20worksheet%20with%20a%20bunch%20of%20data%20and%20" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F&amp;title=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F&amp;t=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F&amp;submitHeadline=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data&amp;submitSummary=A%20very%20common%20task%20you%20may%20have%20is%20to%20take%20a%20chart%20you%27ve%20painstakingly%20formatted%20and%20use%20it%20with%20new%20data.%20I%20described%20a%20few%20ways%20to%20handle%20this%20in%20Make%20a%20Copied%20Chart%20Link%20to%20New%20Data.%0D%0A%0D%0AMost%20commonly%20you%20have%20a%20worksheet%20with%20a%20bunch%20of%20data%20and%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcopy-pivot-table-pivot-chart-link-to-new-data%2F&amp;t=Copy%20a%20Pivot%20Table%20and%20Pivot%20Chart%20and%20Link%20to%20New%20Data&amp;s=A%20very%20common%20task%20you%20may%20have%20is%20to%20take%20a%20chart%20you%27ve%20painstakingly%20formatted%20and%20use%20it%20with%20new%20data.%20I%20described%20a%20few%20ways%20to%20handle%20this%20in%20Make%20a%20Copied%20Chart%20Link%20to%20New%20Data.%0D%0A%0D%0AMost%20commonly%20you%20have%20a%20worksheet%20with%20a%20bunch%20of%20data%20and%20" title="Tumblr"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/copy-pivot-table-pivot-chart-link-to-new-data/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Time Trials of Approaches to Measure Minimum and Maximum Chart Values</title>
		<link>http://peltiertech.com/WordPress/time-trials-measure-min-max-excel-chart-values/</link>
		<comments>http://peltiertech.com/WordPress/time-trials-measure-min-max-excel-chart-values/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 07:00:34 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[series formula]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=3182</guid>
		<description><![CDATA[In Get a Maximum and Minimum Value from Certain Charts, John Mansfield showed a simple routine he uses to find the maximum and minimum Y values in a chart. In the ensuing discussion, alternatives were suggested with various justifications. I wanted to say that this one was faster than that one, but I realized that [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.cellmatrix.net/index.php/site/comments/get_a_maximum_and_minimum_value_from_certain_charts/" rel="nofollow" title="Get a Maximum and Minimum Value from Certain Charts" >Get a Maximum and Minimum Value from Certain Charts</a>, John Mansfield showed a simple routine he uses to find the maximum and minimum Y values in a chart. In the ensuing discussion, alternatives were suggested with various justifications. I wanted to say that this one was faster than that one, but I realized that I didn&#8217;t know what was fastest. So I decided a series of time trials were called for.</p>
<h2>Experimental Design</h2>
<p>There are two ways to find the minimum and maximum of a set of values:</p>
<ul style="margin-left: 24pt;">
<li>Loop through the values, and keep track of the largest and smallest you&#8217;ve encountered</li>
<li>Use the worksheet functions <tt class="tt">MIN()</tt> and <tt class="tt">MAX()</tt> (i.e., <tt class="tt">WorksheetFunction.Min</tt> and <tt class="tt">.Max</tt>)</li>
</ul>
<p>There are three ways to obtain the values for each series:</p>
<ul style="margin-left: 24pt;">
<li>Use the <tt class="tt">.Values</tt> property of the series, which returns a 1-D array</li>
<li>Parse the series formula to identify the range, then get the <tt class="tt">.Value</tt> of this range object, which returns a 2-D array</li>
<li>Parse the series formula to identify the range, and analyze the range itself</li>
</ul>
<p><span id="more-3182"></span>This suggests a 2&#215;3 matrix, but I eliminated looping cell-by-cell through the range to find the largest and smallest values, since experience shows that looping through the cells of a range in this way is much slower than using the <tt class="tt">.Value</tt> property of the range to generate an array, and working with this array.</p>
<p>The five-block test matrix becomes:</p>
<ul style="margin-left: 24pt;">
<li>Looping Over Series Values</li>
<li>Worksheet Function on Series Values</li>
<li>Looping Over Range Values</li>
<li>Worksheet Function on Range Values</li>
<li>Worksheet Function on Range Object</li>
</ul>
<p>I wrote VBA procedures to perform each of these approaches. Then I wrote a master procedure that called each of these procedures 1000 times, 50 times each in 20 blocks, so I&#8217;d have the mean time for each block. The overall mean and standard deviation of the block means can be used to compare the different approaches.</p>
<p>I used a simple XY chart with 1000 points. Both X and Y values were taken from the standard normal distribution. The procedures below could be adapted to check the Y values of any chart and the X values of an XY chart or a line/column/bar/area chart with a date scale X axis. Here the X values don&#8217;t matter since I was merely sampling Y.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-03/1000datapoints.png" alt="XY chart used in Min-Max time trials" /></p>
<p>I ran the tests in Excel 2003 SP3 on a reasonably modern laptop, running Windows 7 Ultimate with 4GB of memory on a 2.20 GHz dual-core AMD processor.</p>
<h2>VBA Procedures</h2>
<h3>Looping Over Series Values</h3>
<pre class="vbasmall"><code>Sub Max_Min_Loop_Values()
  Dim Cht As Chart
  Dim Srs As Series
  Dim i As Long
  Dim A As Variant
  Dim MinVal As Double
  Dim MaxVal As Double 

  Set Cht = ActiveSheet.ChartObjects(1).Chart
  Set Srs = Cht.SeriesCollection(1)
  A = Srs.Values
  MaxVal = A(LBound(A, 1))
  MinVal = A(LBound(A, 1))
  For i = LBound(A, 1) + 1 To UBound(A, 1)
    If A(i) &gt; MaxVal Then MaxVal = A(i)
    If A(i) &lt; MinVal Then MinVal = A(i)
  Next i
End Sub</code></pre>
<p>Assuming there is one chart on the active worksheet, and one series in the chart, we set the chart and the series simply. We assign the Y values of the series to an array, and initially set the minimum and maximum values to the first value in the array. Then we loop from the second to the last values in the array, and if a given value is larger than the maximum value so far, we set the new maximum to the current value, and likewise for the minimum. I didn&#8217;t output the minimum and maximum values, all I wanted was the time to run the core of the procedure.</p>
<h3>Worksheet Function on Series Values</h3>
<pre class="vbasmall"><code>Sub Max_Min_Wkfn_Values()
  Dim Cht As Chart
  Dim Srs As Series
  Dim A As Variant
  Dim MinVal As Double
  Dim MaxVal As Double  

  Set Cht = ActiveSheet.ChartObjects(1).Chart
  Set Srs = Cht.SeriesCollection(1)
  A = Srs.Values
  With WorksheetFunction
    MaxVal = .Max(A)
    MinVal = .Min(A)
  End With
End Sub</code></pre>
<p>We set the chart and the series simply as above. We assign the Y values of the series to an array, and use the worksheet functions <tt class="tt">Min()</tt> and <tt class="tt">Max()</tt> to determine the minimum and maximum values.</p>
<h3>Looping Over Range Values</h3>
<pre class="vbasmall"><code>Sub Max_Min_Loop_RangeArray()
  Dim Cht As Chart
  Dim Srs As Series
  Dim i As Long
  Dim A As Variant
  Dim MinVal As Double
  Dim MaxVal As Double
  Dim sSeriesFmla As String 

  Set Cht = ActiveSheet.ChartObjects(1).Chart
  Set Srs = Cht.SeriesCollection(1)
  sSeriesFmla = Split(Srs.Formula, ",")(2)
  A = Range(sSeriesFmla).Value
  MaxVal = A(LBound(A, 1), 1)
  MinVal = A(LBound(A, 1), 1)
  For i = LBound(A, 1) + 1 To UBound(A, 1)
    If A(i, 1) &gt; MaxVal Then MaxVal = A(i, 1)
    If A(i, 1) &lt; MinVal Then MinVal = A(i, 1)
  Next i
End Sub</code></pre>
<p>We set the chart and the series simply as above. We parse the formula of the series to find the range, use the <tt class="tt">.Value</tt> property of the range to define an array, and initially set the minimum and maximum values to the first value in the array. Then we loop from the second to the last values in the array, and if a given value is larger than the maximum value so far, we set the new  maximum to the current value, and likewise for the minimum.</p>
<h3>Worksheet Function on Range Values</h3>
<pre class="vbasmall"><code>Sub Max_Min_Wkfn_RangeArray()
  Dim Cht As Chart
  Dim Srs As Series
  Dim A As Variant
  Dim MinVal As Double
  Dim MaxVal As Double
  Dim sSeriesFmla As String 

  Set Cht = ActiveSheet.ChartObjects(1).Chart
  Set Srs = Cht.SeriesCollection(1)
  sSeriesFmla = Split(Srs.Formula, ",")(2)
  A = Range(sSeriesFmla).Value
  With WorksheetFunction
    MaxVal = .Max(A)
    MinVal = .Min(A)
  End With
End Sub</code></pre>
<p>We set the chart and the series simply as above. We parse the formula of  the  series to find the range, use the <tt class="tt">.Value</tt> property of the range to define an array, and use the worksheet functions <tt class="tt">Min()</tt> and <tt class="tt">Max()</tt> to determine the minimum and maximum values.</p>
<h3>Worksheet Function on Range Object</h3>
<pre class="vbasmall"><code>Sub Max_Min_Wkfn_Range()
  Dim Cht As Chart
  Dim Srs As Series
  Dim rng As Range
  Dim MinVal As Double
  Dim MaxVal As Double
  Dim sSeriesFmla As String 

  Set Cht = ActiveSheet.ChartObjects(1).Chart
  Set Srs = Cht.SeriesCollection(1)
  sSeriesFmla = Split(Srs.Formula, ",")(2)
  Set rng = Range(sSeriesFmla)
  With WorksheetFunction
    MaxVal = .Max(rng)
    MinVal = .Min(rng)
  End With
End Sub</code></pre>
<p>We set the chart and the series simply as above. We parse the formula of the series to find the range, and use the Worksheet Functions <tt class="tt">Min()</tt> and <tt class="tt">Max()</tt> to determine the minimum and maximum values of the range object directly.</p>
<h3>Timing Procedure</h3>
<pre class="vbasmall"><code>Sub TestTimes()
  Dim Looper As Long
  Dim Blocker As Long
  Dim tStart As Double
  Dim tTotal As Double
  Const LooperMax As Long = 50
  Const BlockerMax As Long = 20  

  For Blocker = 1 To BlockerMax
    tStart = Timer
    For Looper = 1 To LooperMax
      Max_Min_Loop_Values
    Next
    tTotal = Timer - tStart
    WriteToLog "Loop - Values: " &amp; tTotal &amp; " sec for " &amp; LooperMax &amp; " iterations"
  Next  

  For Blocker = 1 To BlockerMax
    tStart = Timer
    For Looper = 1 To LooperMax
      Max_Min_Wkfn_Values
    Next
    tTotal = Timer - tStart
    WriteToLog "Func - Values: " &amp; tTotal &amp; " sec for " &amp; LooperMax &amp; " iterations"
  Next  

  For Blocker = 1 To BlockerMax
    tStart = Timer
    For Looper = 1 To LooperMax
      Max_Min_Loop_RangeArray
    Next
    tTotal = Timer - tStart
    WriteToLog "Loop - RngArr: " &amp; tTotal &amp; " sec for " &amp; LooperMax &amp; " iterations"
  Next  

  For Blocker = 1 To BlockerMax
    tStart = Timer
    For Looper = 1 To LooperMax
      Max_Min_Wkfn_RangeArray
    Next
    tTotal = Timer - tStart
    WriteToLog "Func - RngArr: " &amp; tTotal &amp; " sec for " &amp; LooperMax &amp; " iterations"
  Next  

  For Blocker = 1 To BlockerMax
    tStart = Timer
    For Looper = 1 To LooperMax
      Max_Min_Wkfn_Range
    Next
    tTotal = Timer - tStart
    WriteToLog "Func - Range:  " &amp; tTotal &amp; " sec for " &amp; LooperMax &amp; " iterations"
  Next 

End Sub</code></pre>
<p>This procedure calls each of the Min_Max procedures <tt class="tt">LooperMax</tt> (50) times, records the total time for 50 iterations, and repeats this <tt class="tt">BlockerMax</tt> (20) times for each procedure, before moving on to the next. The times are recorded in a text file using the <tt class="tt">WriteToLog</tt> procedure below.</p>
<h3>Logging Procedure</h3>
<pre class="vbasmall"><code>Public Sub WriteToLog(sLogEntry As String)
  ' write information to a log file
  Dim iFile As Integer
  Dim sFileName As String
  Const sLogFile As String = "TimeLogger"   

  sFileName = ThisWorkbook.Path &amp; "\" &amp; sLogFile &amp; Format$(Now, "YYMMDD") &amp; ".txt"
  iFile = FreeFile
  Open sFileName For Append As iFile
  Print #iFile, Now; " "; sLogEntry
  Close iFile
End Sub</code></pre>
<p>This is a very handy procedure I use all the time for logging debug information or for saving settings. It uses good old VB I/O protocols, which are very fast, to populate a text file.</p>
<h2>Test Results</h2>
<p>The results of these experiments are shown in the following table. The approaches are sorted from slowest to fastest. Processing an array extracted from the source data range takes about 1.2 milliseconds, whether looping or using the worksheet functions. Processing the series values array takes about 0.7 milliseconds by either technique. Measuring the range directly takes less than 0.5 milliseconds.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-03/1000iterationstats.png" alt="XY chart used in Min-Max time trials" /></p>
<p>50-iteration means of the 20 blocks for each approach are plotted in this chart, with means sorted from fastest to slowest to give a pseudo-distribution of procedure times.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-03/1000iterationplot.png" alt="XY chart used in Min-Max time trials" /></p>
<p>This chart is stepped, because there seems to be a discrete quantum of time, that is, a resolution of about 0.078 milliseconds in the measurement of time using VBA&#8217;s Timer function on this microprocessor.</p>
<h2>What These Results Mean</h2>
<p>One school of thought is that looping an array would be slow compared to  a single function call, while another is that any call from VBA to  Excel (i.e., <tt class="tt">WorksheetFunction</tt>) would incur a  performance hit. An unexpected result is that on this machine, it makes essentially no difference whether I use a loop or worksheet functions to find the minimum and maximum values in a series of 1000 points. I guess that&#8217;s why we occasionally bother to run these time trials.</p>
<p>We see that using the array of series values is faster than using the array of values from the source data range, by not quite a factor of two. Thinking of the VBA-Excel interface, we have to cross it once to get the series values, or twice to get the series formula and again to get the range values. This makes sense, and I have to admit, I would never have thought of getting the values from the source data range, since they are so easy to extract using series <tt class="tt">.Values</tt>.</p>
<p>The fastest method of all, which was proposed by Daniel Ferry (<a href="http://excelhero.com/blog" rel="nofollow" >Excel Hero</a>), is to parse the series formula to find the range, and directly measure the min and max of this range. Apparently the performance hit to cross the VBA-Excel barrier is offset by the much faster performance of worksheet functions operating on Excel objects directly within Excel.</p>
<p>Although the direct range object measurement approach is fastest, I will stick to my series values approach. The main reason is that not all series values come from a single range in a worksheet, or even from a worksheet range at all: some series use multiple area ranges, while others have values hard-coded as a literal array directly in the series formula.</p>
<p>This is a &#8220;normal&#8221; series formula (based on the first ten points of experimental data from our chart above):</p>
<pre class="vbasmall"><code>=SERIES(<span style="color: #008000;">Sheet1!$B$1</span>,<span style="color: #800080;">Sheet1!$A$2:$A$11</span>,<span style="color: #0000ff;">Sheet1!$B$2:$B$11</span>,<span style="color: #ff0000;">1</span>)</code></pre>
<p>In this formula, <span style="color: #008000;">the series name is the argument in green</span>, <span style="color: #800080;">X values are in purple</span>, <span style="color: #0000ff;">Y values are in blue</span>, and <span style="color: #ff0000;">plot order is in red</span>. These are the same colors Excel uses to highlight the data ranges of a selected series in the underlying worksheet (illustrated below).</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-03/10datapointhighlight.png" alt="Excel highlights data range of selected=" /></p>
<p>This formula is for a series that uses multiple area ranges for X and Y values, the areas for X and Y enclosed in parentheses:</p>
<pre><code>=SERIES(Sheet1!$B$1,(Sheet1!$A$2:$A$501,Sheet1!$A$502:$A$1001),
(Sheet1!$B$2:$B$501,Sheet1!$B$502:$B$1001),1)</code></pre>
<p>Multiple area formulas are not too uncommon. Less common is a series whose formula has hard-coded arrays as series values (first ten points of experimental data converted to values using F9 key):</p>
<pre class="vbasmall"><code>=SERIES(<span style="color: #008000;">"Y"</span>,<span style="color: #800080;">{-0.172902780162854;0.0788276881579948;0.752718316150293;-1.15534740638389;
-0.651271029427549;1.61522977181724;0.218894823127643;-1.38264191435207;
0.107605524088065;0.281018951052876}</span>,
<span style="color: #0000ff;">{-0.640448122430912;-0.355817827507841;-0.318480200209528;-0.0116013833433011;
-1.15185971606638;0.183605522997797;-0.376897171002227;-0.488810695788606;
-2.14375416629929;0.154502474308393}</span>,<span style="color: #ff0000;">1</span>)</code></pre>
<p>There is a practical limit of around 250 characters (you&#8217;d guess 255, but it&#8217;s slightly less) each for the X values and Y values of a series formula. In the formula above, the ten X values consume 183 characters, the ten Y values 188. You can squeeze in more values by reducing the resolution of the values (e.g., -0.173 in place of -0.172902780162854), but that&#8217;s just nibbling around the margins. A practical limit is around 17 or 18 values before the formula crashes.</p>
<p>The arrays (within {curly braces} above) are delimited by semicolons in this case, because the original data came from a column, but data in rows would be delimited by commas.</p>
<p>These complications in the series formula lead to errors when using simple approaches to parse such formulas. John Walkenbach has developed <a href="http://spreadsheetpage.com/index.php/tip/a_class_module_to_manipulate_a_chart_series/" rel="nofollow" title="Spreadsheet Page Excel Tips: A Class Module To Manipulate A Chart Series" >A Class Module To Manipulate A Chart Series</a> which can deal with such difficult situations.</p>
<p>Since accessing values using the <tt class="tt">.Values</tt> property is so easy, and since this approach is only about 50% slower than the risky approach of parsing the formula and measuring the range directly, that&#8217;s the approach I will stick with.</p>
<p>Peltier Technical Services, Inc., Copyright © 2010.<br /> <br /><span style="font: 80% Verdana,Tahoma,Arial,sans-serif;">Licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow" rel="license" >Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.<br /> <br />
<a href="http://www.exceluser.com/cmd.asp?Clk=2474005" rel="nofollow" ><IMG SRC="http://www.exceluser.com/images/info/pub/pnp468_01.jpg" ALT="Create Excel dashboards quickly with Plug-N-Play reports." WIDTH="468" HEIGHT="60" border=0></a><br />
<br /><img src="http://www.exceluser.com/cmd.asp?Imp=2474005" width="0" height="0" border="0"></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://twitter.com/home?status=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F&amp;title=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values&amp;bodytext=In%20Get%20a%20Maximum%20and%20Minimum%20Value%20from%20Certain%20Charts%2C%20John%20Mansfield%20showed%20a%20simple%20routine%20he%20uses%20to%20find%20the%20maximum%20and%20minimum%20Y%20values%20in%20a%20chart.%20In%20the%20ensuing%20discussion%2C%20alternatives%20were%20suggested%20with%20various%20justifications.%20I%20wanted%20t" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F&amp;t=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F&amp;title=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values&amp;source=Peltier+Tech+Blog+Peltier+Tech+Excel+Charts+and+Programming+Blog&amp;summary=In%20Get%20a%20Maximum%20and%20Minimum%20Value%20from%20Certain%20Charts%2C%20John%20Mansfield%20showed%20a%20simple%20routine%20he%20uses%20to%20find%20the%20maximum%20and%20minimum%20Y%20values%20in%20a%20chart.%20In%20the%20ensuing%20discussion%2C%20alternatives%20were%20suggested%20with%20various%20justifications.%20I%20wanted%20t" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F&amp;title=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values&amp;notes=In%20Get%20a%20Maximum%20and%20Minimum%20Value%20from%20Certain%20Charts%2C%20John%20Mansfield%20showed%20a%20simple%20routine%20he%20uses%20to%20find%20the%20maximum%20and%20minimum%20Y%20values%20in%20a%20chart.%20In%20the%20ensuing%20discussion%2C%20alternatives%20were%20suggested%20with%20various%20justifications.%20I%20wanted%20t" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F&amp;title=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F&amp;title=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values&amp;annotation=In%20Get%20a%20Maximum%20and%20Minimum%20Value%20from%20Certain%20Charts%2C%20John%20Mansfield%20showed%20a%20simple%20routine%20he%20uses%20to%20find%20the%20maximum%20and%20minimum%20Y%20values%20in%20a%20chart.%20In%20the%20ensuing%20discussion%2C%20alternatives%20were%20suggested%20with%20various%20justifications.%20I%20wanted%20t" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F&amp;title=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F&amp;t=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F&amp;submitHeadline=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values&amp;submitSummary=In%20Get%20a%20Maximum%20and%20Minimum%20Value%20from%20Certain%20Charts%2C%20John%20Mansfield%20showed%20a%20simple%20routine%20he%20uses%20to%20find%20the%20maximum%20and%20minimum%20Y%20values%20in%20a%20chart.%20In%20the%20ensuing%20discussion%2C%20alternatives%20were%20suggested%20with%20various%20justifications.%20I%20wanted%20t&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Ftime-trials-measure-min-max-excel-chart-values%2F&amp;t=Time%20Trials%20of%20Approaches%20to%20Measure%20Minimum%20and%20Maximum%20Chart%20Values&amp;s=In%20Get%20a%20Maximum%20and%20Minimum%20Value%20from%20Certain%20Charts%2C%20John%20Mansfield%20showed%20a%20simple%20routine%20he%20uses%20to%20find%20the%20maximum%20and%20minimum%20Y%20values%20in%20a%20chart.%20In%20the%20ensuing%20discussion%2C%20alternatives%20were%20suggested%20with%20various%20justifications.%20I%20wanted%20t" title="Tumblr"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/time-trials-measure-min-max-excel-chart-values/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Deming Regression</title>
		<link>http://peltiertech.com/WordPress/deming-regression/</link>
		<comments>http://peltiertech.com/WordPress/deming-regression/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 05:30:46 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[Regression]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2468</guid>
		<description><![CDATA[Linear Regression
People are familiar with a standard linear regression (LR) method that makes assumptions about the X and Y variables in the analysis. Excel&#8217;s built-in regression methods make these same assumptions.
The X variable, also called the independent variable, is assumed to be known precisely, and all error in the regression is assumed to be in [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Linear Regression</strong></p>
<p>People are familiar with a standard linear regression (LR) method that makes assumptions about the X and Y variables in the analysis. Excel&#8217;s built-in regression methods make these same assumptions.</p>
<p>The X variable, also called the independent variable, is assumed to be known precisely, and all error in the regression is assumed to be in the measurement of the Y variable, the dependent variable.</p>
<p>This assumption is reasonable enough. But there are cases where errors in the values of X cannot be discounted. For example, X and Y may be comparisons of the output of two different machines for given inputs. When the outputs are compared, both machines are subject to errors in measurement, so the usual assumptions are invalid.</p>
<p><span id="more-2468"></span><strong>Deming Regression Example</strong></p>
<p>Suppose Machines A and B had the following output. At each nominal output value, the results of two runs of each machine are tabulated. There is some variability in measurements of each machine&#8217;s output. The averages of each machine at each nominal output level are shown next to the individual measurements.</p>
<p align="center"><img src="/images/2009-10/DemingData2.png" alt="Data for Deming Regression" /></p>
<p>We may be tempted to plot each machine&#8217;s outputs as Y values against the nominal X values.</p>
<p align="center"><img src="/images/2009-10/DemingPlot1a.png" alt="Simple Regression" /></p>
<p>We may even compute the lines of best fit for the two machines. We can see that they are close, but not exactly the same. The problem with this analysis is that we are not directly regressing one machine against the other.</p>
<p align="center"><img src="/images/2009-10/DemingPlot1b.png" alt="Simple Regression" /></p>
<p>In the Deming Regression, outputs of the two machines are plotted against each other. Pairs of actual outputs are measured for each nominal output, and the differences between the two measurements from each machine will be used to estimate the variation of each machine&#8217;s outputs. The averages of each pair form the basis of the regression, corrected for the machine variation.</p>
<p align="center"><img src="/images/2009-10/DemingPlot2a.png" alt="Deming Regression" /></p>
<p>The table below shows three sets of calculations. The first row shows a standard linear regression of the measured data. The second row shows a standard linear regression performed on the averages of each pair of values. The third shows the Deming regression analysis. Details of the Deming regression calculations are not given here, but a motivated reader can check the links in the references at the end of this article.</p>
<p align="center"><img src="/images/2009-10/DemingStats.png" alt="Deming Regression Results" /></p>
<p>The data are not too different, and in fact the correlation in the LR of the average values and of the Deming regression are identical. In the plot below, lines have been added to show the three sets of results in the table above, as well as the 45 degree line, where Machine B = Machine A. The lines are practically on top of each other.</p>
<p align="center"><img src="/images/2009-10/DemingPlot2b.png" alt="Deming Regression" /></p>
<p>In the example above, there is little difference in the output of the various LR models. However, if Machines A and B exhibit greater variation in their output, there can be noticeable differences.</p>
<p align="center"><img src="/images/2009-10/DemingPlot3.png" alt="Deming Regression" /></p>
<p><strong>Deming Regression Utility</strong></p>
<p>I&#8217;ve created a small utility that facilitates Deming Regression analysis in Excel. Read about it and follow the download link in <a href="http://peltiertech.com/WordPress/deming-regression-utility/"title="Deming Regression Utility | PTS Blog" >Deming Regression Utility</a>.</p>
<p><strong>References</strong></p>
<p><a href="http://www.ahut.edu.cn/yxsz/ahkl/Teaching/Excel%20for%20Chemists/Ch17.pdf" rel="nofollow" >Chapter 17:  Creating  Custom  Functions</a>, Excel for Chemists: A Comprehensive Guide, 2nd Edition. by E. Joseph Billo, Copyright 2001 by John Wiley &amp; Sons, Inc.</p>
<p><a href="http://www.clinchem.org/cgi/reprint/25/3/432.pdf" rel="nofollow" >Incorrect Least-Squares Regression Coefficients in Method-Comparison Analysis</a> by P. Joanne Cornbleet and Nathan Gochman, Clin. Chem. 25/3, 432-438 (1979).</p>
<p>Peltier Technical Services, Inc., Copyright © 2010.<br /> <br /><span style="font: 80% Verdana,Tahoma,Arial,sans-serif;">Licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow" rel="license" >Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.<br /> <br />
<a href="http://www.exceluser.com/cmd.asp?Clk=2474005" rel="nofollow" ><IMG SRC="http://www.exceluser.com/images/info/pub/pnp468_01.jpg" ALT="Create Excel dashboards quickly with Plug-N-Play reports." WIDTH="468" HEIGHT="60" border=0></a><br />
<br /><img src="http://www.exceluser.com/cmd.asp?Imp=2474005" width="0" height="0" border="0"></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://twitter.com/home?status=Deming%20Regression%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression&amp;bodytext=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;t=Deming%20Regression" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression&amp;source=Peltier+Tech+Blog+Peltier+Tech+Excel+Charts+and+Programming+Blog&amp;summary=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression&amp;notes=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression&amp;annotation=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;title=Deming%20Regression" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;t=Deming%20Regression" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Deming%20Regression&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;submitHeadline=Deming%20Regression&amp;submitSummary=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fdeming-regression%2F&amp;t=Deming%20Regression&amp;s=Linear%20Regression%0D%0A%0D%0APeople%20are%20familiar%20with%20a%20standard%20linear%20regression%20%28LR%29%20method%20that%20makes%20assumptions%20about%20the%20X%20and%20Y%20variables%20in%20the%20analysis.%20Excel%27s%20built-in%20regression%20methods%20make%20these%20same%20assumptions.%0D%0A%0D%0AThe%20X%20variable%2C%20also%20called" title="Tumblr"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/deming-regression/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Mind the Gap &#8211; Charting Empty Cells</title>
		<link>http://peltiertech.com/WordPress/mind-the-gap-charting-empty-cells/</link>
		<comments>http://peltiertech.com/WordPress/mind-the-gap-charting-empty-cells/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 06:00:29 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2284</guid>
		<description><![CDATA[Excel offers a few ways to deal with empty cells in a chart&#8217;s source data range. This is the cause of much confusion, especially over the definition of &#8220;empty cells&#8221;. Let&#8217;s take a look at this problem.
Plotting Without Empty Cells
Here are some typical Excel charts, to remind us what they look like with fully populated [...]]]></description>
			<content:encoded><![CDATA[<p>Excel offers a few ways to deal with empty cells in a chart&#8217;s source data range. This is the cause of much confusion, especially over the definition of &#8220;empty cells&#8221;. Let&#8217;s take a look at this problem.</p>
<p><strong>Plotting Without Empty Cells</strong></p>
<p>Here are some typical Excel charts, to remind us what they look like with fully populated data ranges. I&#8217;ve placed data labels on the charts to help show their behavior when empty cells (and other non-numeric fillers) are included in the source data.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/xy_line_noblanks.png" alt="XY and Line Charts, No Empty Cells" /></p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/col_area_noblanks.png" alt="Column and Area Charts, No Empty Cells" /></p>
<p><strong>Plotting With Empty Cells</strong></p>
<p><span id="more-2284"></span>The default behavior for most charts is to treat an empty cell by leaving a gap on the chart. Here are XY and Line charts that show how this looks. Note the lack of data labels where the gaps occur.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/xy_line_gaps.png" alt="XY and Line Charts, With Empty Cells Treated as Gaps" /></p>
<p>You can instead have Excel treat blanks as zeros (which in general is deceiving, since empty cells mean the absence of a value, not a value of zero). Note the data labels indicating a value of zero.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/xy_line_zeros.png" alt="XY and Line Charts, With Empty Cells Treated as Zeros" /></p>
<p>You can also tell Excel to interpolate over the missing data point. No data point means no data label.</p>
<p>Purists may say that the interpolation option may cause readers to think there is data along the line that spans the gap. Maybe so, but if the line or XY chart plots actual data points with markers, this is less of a risk.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/xy_line_interp.png" alt="XY and Line Charts, With a Line Interpolated Across Empty Cells" /></p>
<p>Column charts offer only the gap and zero options for empty cells. Interpolating makes no sense in a column chart, which has discrete bars for each actual data value. The chart with a gap has no data label at the gap, the chart with zeros has a zero data label.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/col_gaps_zeros.png" alt="Column Charts, With Empty Cells Treated as Gaps and as Zeros" /></p>
<p>If we change the vertical axis so that the horizontal axis crosses below zero, we see that the first chart has no data point (bar) corresponding to the gap, but the second has a point (bar) with a value of zero.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/col_gaps_zeros_scale.png" alt="Column Charts, With Empty Cells Treated as Gaps and as Zeros" /></p>
<p>Area charts seem to offer both the zero and interpolation options, but in both cases, the chart plunges to zero without a corresponding data label. If we mess with the vertical axis, the chart still plunges exactly to zero in both cases.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/areas_zeros_interp.png" alt="Area Charts, With Empty Cells Treated as Zeros, or Supposedly Interpolated" /></p>
<p>A more suitable appearance for an area chart would be one that leaves a real gap, with vertical edges, as below. To get this I had to make a two-axis chart, with a hidden series on the primary axis to provide the A-B-C category axis labels, and an area chart on the secondary axis, with two points at the second category (Y=4 and zero) and two at the fourth category (Y=zero and 8). A date scale on the secondary category axis aligns these points above each other to produce the vertical-sided gap. This only took me three minutes to construct, but an average user might never quite get it.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/area_gaps.png" alt="Area Charts, With Empty Cells Treated as Gaps, if We Had Our Way" /></p>
<p>The protocol to produce an area chart with a gap that has vertical sides is given in <a href="http://peltiertech.com/WordPress/excel-area-chart-with-gap/"title="Area Chart With Gap » Peltier Tech Blog" >Area Chart With Gap » Peltier Tech Blog</a></p>
<p>Pie charts don&#8217;t seem to offer any options for dealing with blanks, but the grayed-out default is the gap option. In the chart at the right, there is no point (wedge) and no corresponding data label where the empty cell would be plotted.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/pie_noblanks_blanks.png" alt="Pie Charts, Without and With Empty Cells" /></p>
<p>Apparently all charts except the Area chart provide a non-plotted point for an empty cell in the data range, though we can spoil that by selecting the option to treat a gap as a zero value.</p>
<p><strong>Simulating Empty Cells</strong></p>
<p>The main confusion comes along when someone uses formulas to fill the source data range.</p>
<p>The problem arises because  a formula that links to an empty cell</p>
<p>=A1</p>
<p>doesn&#8217;t display a blank, it displays the value zero.</p>
<p>Unfortunately Excel has no formulaic way to simulate a blank in a cell. There is no formulaic way, then, to get an actual gap in a chart. A function like BLANK() or NULL() would be nice, and we&#8217;ll keep asking. But we won&#8217;t hold our breath. And if we really need it, we can hack something in VBA.</p>
<p>Andy Pope shares a workaround in <a href="http://andypope.info/charts/brokenlines.htm" rel="nofollow" >Broken Lines for formula linked data</a>, but it requires one or more dummy series with a line color matching the chart background, which obscure the existing line where the gaps should go.</p>
<p>What people try to do to fake a blank is return &#8220;&#8221; in the formula.</p>
<p>=IF(A1=&#8221;",&#8221;",A1)</p>
<p>The result <em>looks</em> to you and me like a blank, but to Excel, &#8220;&#8221; is a text string, albeit a short one, and it is therefore assigned a value of zero. These charts use &#8220;&#8221; in a logical yet misguided attempt to simulate an empty cell. All charts plunge to zero, and all display a data label showing the value zero.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/xy_line_quotes.png" alt="XY and Line Charts, Empty Cells Simulated by Zero-Length Text" /></p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/col_area_quotes.png" alt="Column and Area Charts, Empty Cells Simulated by Zero-Length Text" /></p>
<p>People have learned that the #N/A error in a worksheet cell is often not plotted in a chart. In a formula, the function NA() returns this error.</p>
<p>=IF(A1=&#8221;",NA(),A1)</p>
<p>What #N/A does is prevent the rendering of a marker in XY and line charts: notice the lack of markers and data labels. It&#8217;s not a gap, but it&#8217;s pretty much the next best thing.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/xy_line_na.png" alt="XY and Line Charts, Empty Cells Simulated by #N/A Error" /></p>
<p>This doesn&#8217;t work as well in other chart types. The column and area charts place a data label showing #N/A at zero. For these chart types it would be better to use &#8220;&#8221; or even zero, and apply a custom number format that suppresses the display of zeros (a format like &#8220;0;-0;;&#8221;).</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/col_area_na.png" alt="Column and Area Charts, Empty Cells Simulated by #N/A Error" /></p>
<p>A pie chart will behave like a column or area chart: there is no visible point (wedge) but there is a data label showing zero or #N/A where the wedge would be located.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2009-07/pie_quotes_na.png" alt="Pie Charts, Empty Cells Simulated by Zero-Length Text and by #N/A Error" /></p>
<p><strong>Summary</strong></p>
<p>The least deceptive way to display an empty cell in a chart, is to treat it as a blank. In line or XY charts, it is generally acceptable to interpolate across the blank with a line, if there are markers plotted for every actual data value. In the vast majority of cases, it is not appropriate to treat empty cells as zeros.</p>
<p>To simulate an empty cell in a line or XY chart, use NA() in your formula to produce the #N/A error in the cell. This produces an ugly #N/A error in the cell, but this error suppresses plotting of a point, and the line spans the position corresponding to the error&#8217;s slot in the data range. It&#8217;s not as good as a gap, but it&#8217;s perhaps the next best thing.</p>
<p>In an area or pie chart, the best approach is to use the null string &#8220;&#8221;, in conjunction with a number format that suppresses the display of zero values.</p>
<p>For an area chart you have to stand on your head to create a complicated chart that simulates a vertical edged gap and provides appropriate category axis labels.</p>
<p>Alternatively you could rely on VBA to clear cells which need to be cleared, but this routine would have to run every time the data range is changed, and it would have to reintroduce formulas into previously cleared cells as well as clear cells where blanks are needed. Or it could do all of the calculations in VBA, eliminating the worksheet formulas.</p>
<p>Peltier Technical Services, Inc., Copyright © 2010.<br /> <br /><span style="font: 80% Verdana,Tahoma,Arial,sans-serif;">Licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow" rel="license" >Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.<br /> <br />
<a href="http://www.exceluser.com/cmd.asp?Clk=2474005" rel="nofollow" ><IMG SRC="http://www.exceluser.com/images/info/pub/pnp468_01.jpg" ALT="Create Excel dashboards quickly with Plug-N-Play reports." WIDTH="468" HEIGHT="60" border=0></a><br />
<br /><img src="http://www.exceluser.com/cmd.asp?Imp=2474005" width="0" height="0" border="0"></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://twitter.com/home?status=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;bodytext=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;t=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;source=Peltier+Tech+Blog+Peltier+Tech+Excel+Charts+and+Programming+Blog&amp;summary=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;notes=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;annotation=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;t=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;submitHeadline=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;submitSummary=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fmind-the-gap-charting-empty-cells%2F&amp;t=Mind%20the%20Gap%20-%20Charting%20Empty%20Cells&amp;s=Excel%20offers%20a%20few%20ways%20to%20deal%20with%20empty%20cells%20in%20a%20chart%27s%20source%20data%20range.%20This%20is%20the%20cause%20of%20much%20confusion%2C%20especially%20over%20the%20definition%20of%20%22empty%20cells%22.%20Let%27s%20take%20a%20look%20at%20this%20problem.%0D%0A%0D%0APlotting%20Without%20Empty%20Cells%0D%0A%0D%0AHere%20are%20some" title="Tumblr"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/mind-the-gap-charting-empty-cells/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>AutoFilter Tricks</title>
		<link>http://peltiertech.com/WordPress/autofilter-tricks/</link>
		<comments>http://peltiertech.com/WordPress/autofilter-tricks/#comments</comments>
		<pubDate>Fri, 22 May 2009 10:00:35 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[AutoFilter]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=1963</guid>
		<description><![CDATA[Apply an AutoFilter to an Excel Pivot Table
Excel Pivot Tables are a very powerful feature, and the AutoFilter is also very useful. The row fields of the Pivot Table can be manipulated like an AutoFilter, but the data fields cannot be sorted or filtered. And if you try to apply an AutoFilter to a pivot [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Apply an AutoFilter to an Excel Pivot Table</strong></p>
<p>Excel Pivot Tables are a very powerful feature, and the AutoFilter is also very useful. The row fields of the Pivot Table can be manipulated like an AutoFilter, but the data fields cannot be sorted or filtered. And if you try to apply an AutoFilter to a pivot table, you find the menu command disabled.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/PTAutoFilterMenu.png" alt="AutoFilter options with active cell in Pivot Table" /></p>
<p><span id="more-1963"></span>But I learned a trick this week at the <a href="http://peltiertech.com/WordPress/second-excel-dashboard-boot-camp-may-2009/"title="Excel Dashboard and Visualization Boot Camp" >Excel Dashboard and Visualization Bootcam</a>p. If you select a cell which borders on the pivot table, but is not part of the pivot table,&#8230;</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/PTNoAutoFilter.png" alt="Select a cell next to the Pivot Table" /></p>
<p>&#8230;the AutoFilter menu items are now enabled.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/NoPTAutoFilterMenu.png" alt="AutoFilter options with active cell outside of Pivot Table" /></p>
<p>Select AutoFilter, and the Pivot Table has been AutoFilter enabled.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/PTWithAutoFilter.png" alt="Select a cell next to the Pivot Table" /></p>
<p>These conferences are great.</p>
<p><strong>AutoFilter by Selection</strong></p>
<p>Access has a feature that lets you quickly apply a filter based on the selected item. Wouldn&#8217;t it be great to have this in Excel?</p>
<p>Well, this feature exists, and it&#8217;s built in. But it&#8217;s not present on the default menus or ribbons. You have to dig it out and install it yourself.</p>
<p><em><strong>Excel 2003 and earlier</strong></em></p>
<p>On Excel&#8217;s Tools menu, select Customize, click on the Commands tab, select the Data item in the Caegories list, click on the AutoFilter item, and drag it to a convenient place on a toolbar or menu.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/CustomizeAutoFilter.png" alt="AutoFilter command in the Customization dialog" /></p>
<p>I&#8217;ve put this just under the &#8220;regular&#8221; AutoFilter item on my Data menu/Filter submenu.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/NoPTAutoFilterMenu.png" alt="AutoFilter options with active cell outside of Pivot Table" /></p>
<p><em><strong>Excel 2007</strong></em></p>
<p>Click on the down arrow to the right of the Quick Access Toolbar, and select More Commands from the popup menu.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/CustomizeQAT.png" alt="The Customize QAT menu" /></p>
<p>In the oversized dialog that appears, select Commands not in the Ribbon from the right hand dropdown, select AutoFilter, click Add, and press OK.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/ExcelOptions.png" alt="Adding the AutoFilter command to the QAT" /></p>
<p>The AutoFilter icon appears on the QAT.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-05/AutoFilterontheQAT.png" alt="AutoFilter command on the QAT" /></p>
<p><em><strong>What the &#8220;New&#8221; AutoFilter does</strong></em></p>
<p>This Autofilter command shares a name with the &#8220;other&#8221; AutoFilter command, but it has a unique icon, and its functionality is enhanced. The command creates an AutoFilter using the range that includes the active cell, then it filters this range based on the active cell.</p>
<p>Peltier Technical Services, Inc., Copyright © 2010.<br /> <br /><span style="font: 80% Verdana,Tahoma,Arial,sans-serif;">Licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow" rel="license" >Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.<br /> <br />
<a href="http://www.exceluser.com/cmd.asp?Clk=2474005" rel="nofollow" ><IMG SRC="http://www.exceluser.com/images/info/pub/pnp468_01.jpg" ALT="Create Excel dashboards quickly with Plug-N-Play reports." WIDTH="468" HEIGHT="60" border=0></a><br />
<br /><img src="http://www.exceluser.com/cmd.asp?Imp=2474005" width="0" height="0" border="0"></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://twitter.com/home?status=AutoFilter%20Tricks%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks&amp;bodytext=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;t=AutoFilter%20Tricks" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks&amp;source=Peltier+Tech+Blog+Peltier+Tech+Excel+Charts+and+Programming+Blog&amp;summary=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks&amp;notes=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks&amp;annotation=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;title=AutoFilter%20Tricks" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;t=AutoFilter%20Tricks" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=AutoFilter%20Tricks&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;submitHeadline=AutoFilter%20Tricks&amp;submitSummary=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fautofilter-tricks%2F&amp;t=AutoFilter%20Tricks&amp;s=Apply%20an%20AutoFilter%20to%20an%20Excel%20Pivot%20Table%0D%0A%0D%0AExcel%20Pivot%20Tables%20are%20a%20very%20powerful%20feature%2C%20and%20the%20AutoFilter%20is%20also%20very%20useful.%20The%20row%20fields%20of%20the%20Pivot%20Table%20can%20be%20manipulated%20like%20an%20AutoFilter%2C%20but%20the%20data%20fields%20cannot%20be%20sorted%20or%20fi" title="Tumblr"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/autofilter-tricks/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Calculating Wind Direction per DDoE</title>
		<link>http://peltiertech.com/WordPress/calculating-wind-direction-ddoe/</link>
		<comments>http://peltiertech.com/WordPress/calculating-wind-direction-ddoe/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 09:30:36 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=1853</guid>
		<description><![CDATA[In Calculating Wind Direction, Dick Kusleika helped solve the problem of calculating a wind direction using a best fit trendline, given wind directions that may vary on either side of 360°. Dick&#8217;s original data has wind directions in degrees at various altitudes in feet. The requirement is to estimate the wind direction at the intermediate [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.dailydoseofexcel.com/archives/2009/04/28/calculating-wind-direction/" rel="nofollow" title="Calculating Wind Direction" >Calculating Wind Direction</a>, Dick Kusleika helped solve the problem of calculating a wind direction using a best fit trendline, given wind directions that may vary on either side of 360°. Dick&#8217;s original data has wind directions in degrees at various altitudes in feet. The requirement is to estimate the wind direction at the intermediate altitude of 3000 ft. Interpolation between the wind directions at 2000 and 5000 feet may be adequate, but let&#8217;s play along and use Dick&#8217;s best fit solution.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionOrigData.png" alt="Wind Direction Original Data" /></p>
<p>One of the answers to the generic question &#8220;Why do we need charts?&#8221; is to gain insight into a problem before we try to solve it.</p>
<p>Dick showed a couple of charts, lame little pie charts actually, which hand-waved a clever little trick he used to account for directions on either side of 360°. I&#8217;ll show how using more carefully crafted charts could have helped lead to the same result more quickly, by showing exactly what the relationships are. I will also show how such charts can easily show when a simplified approach is too simple, and leads to a very wrong answer.</p>
<p><span id="more-1853"></span>When charted, the original data looks like the following.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionOriginal.png" alt="Original Wind Direction" /></p>
<p>By inspection, we can see that Directions 4 and 5 are pretty nearly straight lines as drawn, while the other three have points on either side of 360°. To turn these into linear fits, we need to add or subtract 360° so that the lines can cross 360° (or 0°).</p>
<p>Here is the data, corrected by adding 360° as appropriate. The calculated wind directions at 3000 ft are shown in blue.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionCorrData2.png" alt="Wind Direction Corrected Data" /></p>
<p>Which leads to this chart. All five cases now follow nearly straight lines.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionCorrected2.png" alt="Corrected Wind Direction" /></p>
<p><strong>Dick&#8217;s Approach</strong></p>
<p>The trick is knowing which data needs to be &#8220;enhanced&#8221;.Obviously you need to correct the ones which have values concentrated at the ends of the 0 to 360° range.</p>
<p>Dick&#8217;s approach was to examine the three directions in each case, and if the difference between the min and the max exceeded 180°, he added 180° and moduloed by 360°. This took data which was arranged around 360° and rearranged it around 180°. To these cases he then added 180° to the calculated result, and again moduloed by 360°.</p>
<p>Dick&#8217;s magic formula is</p>
<pre class="vbasmall">=IF(MAX(C4:C6)-MIN(C4:C6)&gt;180,
    MOD(FORECAST($B7,MOD(C4:C6+180,360),$B4:$B6)+180,360),
    FORECAST($B7,C4:C6,$B4:$B6))
 </pre>
<p>which is array-entered (by holding Ctrl+Shift while clicking Enter), so in the formula bar it is surrounded by curly brackets. B4:B6 are the altitudes 2000, 5000, and 10000 in the first column, B7 is the target altitude 3000, C4:C6 are the wind directions under the label Direction1, and this formula is entered in C7. As written, this formula can be copied and pasted into D7:G7 to provide all five calculations.</p>
<p>Instead of a difference of 180°, Dick could have used another cutoff value to decide which data needs correction. Alternatively, a check of the correlation or residuals of the three points could indicate whether the points are nearly aligned or far from linear. These latter approaches are more computationally intensive.</p>
<p>Dick&#8217;s calculated results for 3000 ft are shown by the squares in the chart above. They are all pretty close to the line segments connecting the 2000 ft and 5000 ft data.</p>
<p><strong>Alternative Approach, Simple but Wrong</strong></p>
<p>A comment by &#8220;T&#8221; suggested using some trig to convert all angles to fit into the ragne -180 to 180°, and computing the resulting fit. This seems like an easier approach, and if you only check the answers to the first three cases, they agree.</p>
<p>However, converting all angles to the arbitrary range -180 to 180° doesn&#8217;t check to see which angles should be changed. Dick&#8217;s fourth case has wind directiosn {190, 170, 200}, which become {-170, 170, -160}. Oops, now the three directions, which differed by at most 30°, now differ by 340°.</p>
<p>The incorrected directions are shown in the table and chart below.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionIncorrData.png" alt="Wind Direction Improperly Corrected Data" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-04/DirectionIncorrected.png" alt="Improperly Corrected Wind Direction" /></p>
<p>Four of the five cases work out fine, but the fourth is obviously way off. Of course, without a simple chart, it&#8217;s not so obvious. The calculated values are shown as squares at 3000 ft. The black squares match perfectly with Dick&#8217;s solution, but the red square for the fourth data set is way off. If this solution had incorporated a check to see which sets of dta should be converted and which should be left alone, it may have made correct calculations for all cases.</p>
<p>Peltier Technical Services, Inc., Copyright © 2010.<br /> <br /><span style="font: 80% Verdana,Tahoma,Arial,sans-serif;">Licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow" rel="license" >Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.<br /> <br />
<a href="http://www.exceluser.com/cmd.asp?Clk=2474005" rel="nofollow" ><IMG SRC="http://www.exceluser.com/images/info/pub/pnp468_01.jpg" ALT="Create Excel dashboards quickly with Plug-N-Play reports." WIDTH="468" HEIGHT="60" border=0></a><br />
<br /><img src="http://www.exceluser.com/cmd.asp?Imp=2474005" width="0" height="0" border="0"></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://twitter.com/home?status=Calculating%20Wind%20Direction%20per%20DDoE%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE&amp;bodytext=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;t=Calculating%20Wind%20Direction%20per%20DDoE" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE&amp;source=Peltier+Tech+Blog+Peltier+Tech+Excel+Charts+and+Programming+Blog&amp;summary=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE&amp;notes=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE&amp;annotation=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;title=Calculating%20Wind%20Direction%20per%20DDoE" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;t=Calculating%20Wind%20Direction%20per%20DDoE" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Calculating%20Wind%20Direction%20per%20DDoE&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;submitHeadline=Calculating%20Wind%20Direction%20per%20DDoE&amp;submitSummary=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fcalculating-wind-direction-ddoe%2F&amp;t=Calculating%20Wind%20Direction%20per%20DDoE&amp;s=In%20Calculating%20Wind%20Direction%2C%20Dick%20Kusleika%20helped%20solve%20the%20problem%20of%20calculating%20a%20wind%20direction%20using%20a%20best%20fit%20trendline%2C%20given%20wind%20directions%20that%20may%20vary%20on%20either%20side%20of%20360%C2%B0.%20Dick%27s%20original%20data%20has%20wind%20directions%20in%20degrees%20at%20vari" title="Tumblr"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/calculating-wind-direction-ddoe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Prepare Your Data</title>
		<link>http://peltiertech.com/WordPress/prepare-your-data/</link>
		<comments>http://peltiertech.com/WordPress/prepare-your-data/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 10:00:34 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[chart source data]]></category>
		<category><![CDATA[contiguous data]]></category>
		<category><![CDATA[discontiguous data]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=1664</guid>
		<description><![CDATA[I was reading Chandoo&#8217;s post Us vs. Them &#8211; Compare Sales Performance using Charts &#38; Form Controls, and the first step in his protocol was &#8220;Prepare your data&#8221;. I&#8217;m always telling people to prepare their data first. I tell people to spend five minutes on their data, and save themselves five hours of frustration later [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading <strong>Chandoo</strong>&#8217;s post <a href="http://chandoo.org/wp/2009/03/12/comparison-charts-1/" rel="nofollow" title="Us vs. Them - Compare Sales Performance using Charts &amp; Form Controls" >Us vs. Them &#8211; Compare Sales Performance using Charts &amp; Form Controls</a>, and the first step in his protocol was &#8220;Prepare your data&#8221;. I&#8217;m always telling people to prepare their data first. I tell people to spend five minutes on their data, and save themselves five hours of frustration later on. Pay me now or pay me later.</p>
<p>There are a number of aspects involved in preparing your data, and I&#8217;ll cover some of them here. I will concentrate on best practices for chart source data, but the principles also apply for other purposes. Factors to keep in mind are the layout of the data, both in terms of blank rows and columns in the data and whether the data is oriented by row or by column. Aspects of chart data include knowing which ranges of data are used for X and Y values and for series names, and how to get Excel to use the right data for the right parts of the chart. Finally, should you format your chart data so it looks nice in that monthly report, or should you splurge and use multiple data ranges?<span id="more-1664"></span></p>
<h2 style="margin: 0pt 0pt 18px; font-size: 1em;">Contiguous Data Layout</h2>
<p>The best way to arrange data for Excel charts is in a contiguous rectangular range. Contiguous is a two-dollar word that means don&#8217;t skip any rows or columns. For many of its features, if you select a single cell in a range of data, Excel will expand the selection until it reaches empty rows and columns, and use that as its first guess for the range you want used.</p>
<p>This screenshot shows a discontiguous range, B2:E15 with column D and rows 9-10 blank.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData1.png" alt="Discontiguous data range" /></p>
<p>The Chart Wizard was started with cell B3 selected. Note that the highlighted range is only B2:C6. Excel 2007 handles ranges exactly the same way.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData2.png" alt="Excel auto-detects contiguous region around active cell" /></p>
<p>Sometimes you&#8217;re stuck with a discontiguous range. It&#8217;s usually better to convert it into a contiguous range, but if it&#8217;s for a one-off chart, that seems like too much trouble. You can select a discontiguous range and the chart wizard will accept it, or you can identify a discontiguous range in the data range selection box in the dialog, but there are rules that the range must adhere to.</p>
<p>The discontiguous range must be represented as a rectangular range that is subdivided by entire rows and entire columns, like the yellow range B2:E15 below split apart by the pink-shaded column D and rows 9-10. Each area of the range must be selected as a single section: for example, the area E2:E8 must be selected in one step, not as partial sections E2:E4 and E5:E8.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData3.png" alt="Discontiguous data range" /></p>
<p>The Chart Wizard accepts this well-formed discontiguous range.<br class="spacer_" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData4.png" alt="Excel dialogs accept a properly formed discontiguous range" /></p>
<p>If the range does not meet the shape requirement above, the Chart Wizard will accept it, but will jump to the Series tab, and perhaps define the series mysteriously. The Data Range tab will show a message indicating that the range is too complex to be displayed.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData5.png" alt="Excel can't display a complex discontiguous range" /></p>
<p>One test for a well-formed discontiguous range  is whether Excel allows you to select and copy the range. You can select and copy the yellow highlighted range above. When you paste it, it will fill a contiguous range, as in G2:I13 below.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData6.png" alt="You can copy and paste a well-formed discontiguous data range" /></p>
<p>If you try to copy a range which is not well-formed, you get a misleading message that says you can&#8217;t do that with multiple selections. Actually you can do it with some multiple selections, just not the one you&#8217;ve selected.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/DiscontigData7.png" alt="You cannot copy a poorly-formed discontiguous data range" /></p>
<h2 style="margin: 0pt 0pt 18px; font-size: 1em;">Orientation of the Data</h2>
<p>By definitions the data range can be laid out in two orientations: By Row and By Column. Some formulas accept 3D references that in effect have a By Sheet dimension, but for charts the data is strictly 2D.</p>
<p>In general it doesn&#8217;t really matter how your data is oriented. Out of habit, people probably use series data in columns more frequently. This habit probably results from several factors. First, in Excel 2003 and earlier, there are only 256 columns, which severely limits the number of points in your series. There are over 65,000 rows, which is more than twice the 32,000 points allowed in a series.</p>
<p>When data is extracted from a database, it generally comes in with records points) in rows and fields (series) in columns. This range may be a dataset resulting from a query of a database which returns values from fields Alpha, Beta, and Gamma for a certain set of other conditions.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ByRowByCol1.png" alt="Simple data in columns" /></p>
<p>When you apply an autofilter to the data,</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ByRowByCol2.png" alt="Autofilter applied to simple data" /></p>
<p>or in Excel 2003 convert the data range to a List (called a Table in Excel 2007),</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ByRowByCol3.png" alt="Data range converted to a list" /></p>
<p>you gain the ability to filter out rows of data which meet various criteria in each column, or sort the data by columns.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ByRowByCol4.png" alt="Data in columns can be sorted or filtered" /></p>
<h2 style="margin: 0pt 0pt 18px; font-size: 1em;">Chart Source Data</h2>
<p>In general, Excel tries to use data in the selected range for series names and category labels (X values). When using series in columns, this generally means the first row is reserved for series names and the first column for X values.</p>
<p>Excel uses the text labels in the first column for category labels in this line chart.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource01.png" alt="Chart Source Data" /></p>
<p>Excel uses the dates in the first column as X values in this line chart.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource02.png" alt="Chart Source Data" /></p>
<p>Excel doesn&#8217;t see anything special about the years in the first column below. They are numerical values, they are not text, nor are they formatted as dates. Therefore Excel considers them just another set of numbers and plots them as Y values. Of course, they lie far above the other values, which are clustered along the X axis. The X values are simply the counting numbers 1, 2, 3, etc.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource03.png" alt="Chart Source Data" /></p>
<p>That&#8217;s funny, in an XY chart with the same data, Excel uses the years as X values.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource04.png" alt="Chart Source Data" /></p>
<p>Excel&#8217;s behavior is not so hard to understand. In an XY chart, the first column is (almost) always used for X values. In a Line chart, if the first column is notably different from the other columns, it is also used for X values. This difference may be that the column contains text labels, or that it contains values formatted as dates. If the values are years, then they are not sufficiently different from the Y values for Excel to know that they should be treated differently.</p>
<p>Another way to show Excel that the first column and row should be treated differently is to leave the top left cell blank. Now the first column is different, because it has no header. The first row is also different for the same reason.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource05.png" alt="Chart Source Data" /></p>
<p>The line chart below was made with years in the first column, but the blank cell told Excel to use the years as X values.<br class="spacer_" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource06.png" alt="Chart Source Data" /></p>
<p>If you select the chart area or plot area, Excel highlights the source data range. The Y values are highlighted with a blue border, the X values with a purple border, and the series names with a green border. I&#8217;ve highlighted the text in the cells to match the highlighting rectangles.<br class="spacer_" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource07.png" alt="Chart Source Data" /></p>
<p>This blank top left range can be taken further. For example, in the range below, the top two row by two column range is blank. Excel uses the first two columns (under the blank cells) for a two-level set of category axis labels, and the first two rows (alongside the blank cells) for a set of two-cell series names. Excel highlights these ranges using the same color scheme.<br class="spacer_" /></p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/ChartSource08.png" alt="Chart Source Data" /></p>
<h2 style="margin: 0pt 0pt 18px; font-size: 1em;">Multipurpose Data vs. Multiple Copies of the Data</h2>
<p>We&#8217;ve seen how the source data for a chart might be best laid out like this:</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/Table1.png" alt="Chart Source Data" /></p>
<p>while a financial report may have a table with this formatting:</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/Table2.png" alt="Financial Table" /></p>
<p>The source data for a pivot table may look similar to the chart&#8217;s data, with its blank cells filled in:</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/Table3.png" alt="Pivot Table Source Data" /></p>
<p>or it may use actual dates in one column rather than years and months in two:</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/Table4.png" alt="Pivot Table Source Data" /></p>
<p>When you have several uses for your data, and each requires a slightly or greatly different layout, what do you do? It will take hours to try to create a decent chart from the financial report&#8217;s fancy layout, with its centered labels and blank rows and columns. You&#8217;ll never make a proper pivot table from the chart source data or from the financial table.</p>
<p>Back in the day, computer storage came at a premium, and you conserved every byte you could. Since data was stored on magnetic tapes and punch cards, it wasn&#8217;t only memory but also reading and writing of the data that was limiting. Nowadays we have terabyte drives for under $1 per GB, which can transfer data at rates of several GB per minute. It is illogical to try to improve storage efficiency by conserving a few bytes here and there. This paradigm has left the building.</p>
<p>The  solution is easy. Compile a master table of data, then make several copies of the data that link back to this table. The links keep the copies in synch with the original, while each copy of the data can be rearranged to suit a specific purpose.</p>
<p>Create a worksheet with the source data for a pivot table. Place the source data for a chart on another sheet, and if you have multiple charts that require unique layouts, go nuts! Create as many data sheets as you have charts. Link your data into one table that&#8217;s optimized for on-screen viewing, and another table that&#8217;s formatted just perfectly for that  report you print out for the boss every week. Once created and linked, these tables practically maintain themselves.</p>
<p>Peltier Technical Services, Inc., Copyright © 2010.<br /> <br /><span style="font: 80% Verdana,Tahoma,Arial,sans-serif;">Licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow" rel="license" >Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.<br /> <br />
<a href="http://www.exceluser.com/cmd.asp?Clk=2474005" rel="nofollow" ><IMG SRC="http://www.exceluser.com/images/info/pub/pnp468_01.jpg" ALT="Create Excel dashboards quickly with Plug-N-Play reports." WIDTH="468" HEIGHT="60" border=0></a><br />
<br /><img src="http://www.exceluser.com/cmd.asp?Imp=2474005" width="0" height="0" border="0"></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://twitter.com/home?status=Prepare%20Your%20Data%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data&amp;bodytext=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;t=Prepare%20Your%20Data" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data&amp;source=Peltier+Tech+Blog+Peltier+Tech+Excel+Charts+and+Programming+Blog&amp;summary=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data&amp;notes=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data&amp;annotation=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;title=Prepare%20Your%20Data" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;t=Prepare%20Your%20Data" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=Prepare%20Your%20Data&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;submitHeadline=Prepare%20Your%20Data&amp;submitSummary=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fprepare-your-data%2F&amp;t=Prepare%20Your%20Data&amp;s=I%20was%20reading%20Chandoo%27s%20post%20Us%20vs.%20Them%20-%20Compare%20Sales%20Performance%20using%20Charts%20%26amp%3B%20Form%20Controls%2C%20and%20the%20first%20step%20in%20his%20protocol%20was%20%22Prepare%20your%20data%22.%20I%27m%20always%20telling%20people%20to%20prepare%20their%20data%20first.%20I%20tell%20people%20to%20spend%20five%20minu" title="Tumblr"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/prepare-your-data/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>LOESS Smoothing in Excel</title>
		<link>http://peltiertech.com/WordPress/loess-smoothing-in-excel/</link>
		<comments>http://peltiertech.com/WordPress/loess-smoothing-in-excel/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 10:00:15 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[LOESS]]></category>
		<category><![CDATA[LOWESS]]></category>
		<category><![CDATA[Regression]]></category>
		<category><![CDATA[Smoothing]]></category>
		<category><![CDATA[user defined functions]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=1659</guid>
		<description><![CDATA[In 1979 William Cleveland published the LOESS (or LOWESS) technique for smoothing data, and in 1988 he and Susan J. Devlin published a refined version of the technique (references are given at the end of this article). For each X value where a Y value is to be calculated, the LOESS technique performs a regression [...]]]></description>
			<content:encoded><![CDATA[<p>In 1979 William Cleveland published the LOESS (or LOWESS) technique for smoothing data, and in 1988 he and Susan J. Devlin published a refined version of the technique (references are given at the end of this article). For each X value where a Y value is to be calculated, the LOESS technique performs a regression on points in a moving range around the X value, where the values in the moving range are weighted according to their distance from this X value.</p>
<p>The NIST Engineering Statistics Handbook has a good description of the LOESS technique, including a worked example. A commenter named <strong>Nick</strong> used the NIST chapter as a starting point for his implementation of a LOESS function for Excel, and he posted in in <a href="http://junkcharts.typepad.com/junk_charts/2008/05/turning-in-his.html#comment-135008877" rel="nofollow" title="Nick's Excel Implementation of LOESS" >a comment on JunkCharts</a>. Nick&#8217;s approach was to create a UDF in VBA. The UDF accepts as inputs the X and Y data ranges, the number of points to use in the moving regression, and the X value for which to calculate Y. Nick&#8217;s UDF used Dectionary objects to hold intermediate values, and it outputs the Y value for the input X value.</p>
<p><span id="more-1659"></span>I&#8217;ve expanded on Nick&#8217;s starting point, and produced the function presented later in this article. I&#8217;ve discarded the Dictionary objects in favor of VB arrays. It accepts the input X and Y data and the output X values either as ranges or as vertical arrays, and it outputs the calculated LOESS Y values as a vertical array. This means it can be called from within other procedures using arrays, or as a UDF from a worksheet, as an array formula. The original data must be sorted by X in either ascending or descending order (Nick&#8217;s Dictionaries do not require sorted input data, and I have an idea to remove the requirement from my function).</p>
<p>To use the function as a UDF, select the multicell output Y range, and enter this formula:</p>
<pre class="vbasmall">=loess(C2:C22,D2:D22,F2:F21,7)
 </pre>
<p>where C2:C22 and D2:D22 are the input X and Y ranges, F2:F21 is the output X range, and 7 is the number of points in the moving regression (see screenshot below).</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/LOESS_wksht1.png" alt="LOESS in Excel Worksheet 1" /></p>
<p>Enter this as an array formula by holding Ctrl and Shift while pressing Enter, and the selection fills with the calculated Y values. Note the curly braces around the formula in the formula bar, which indicates the formula is an array formula.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/LOESS_wksht2.png" alt="LOESS in Excel Worksheet 2" /></p>
<p>This chart shows the original NIST data points and the smoothed LOESS curve.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/NIST-LOESS.png" alt="LOESS in Excel - NIST Data and Smoothed Curve" /></p>
<p>In <a href="http://en.wikipedia.org/wiki/Local_regression" rel="nofollow" title="Local Regression on Wikipedia" >Local regression</a>, Wikipedia has a decent description of LOESS, with some pros and cons of this approach compared to other smoothing methods.</p>
<p><strong>Example Uses of LOESS</strong></p>
<p>This chart compares LOESS smoothing of website statistics with a simple 7-day moving average. The LOESS captures the major trends in the data, but is less severely affected by week to week fluctuations such as those occuring around Thanksgiving and over the year-end and New Year holidays.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/LOESS_sitestats.png" alt="LOESS vs Moving Average" /></p>
<p>Using LOESS to analyze the body mass indexes (BMI) of Playboy playmates gives more insights than linear regression over the whole data set or over portions of the data. See the discussion in <a href="http://flowingdata.com/2009/02/12/wired-relates-playboy-playmate-bmi-and-average-bmi-1954-2008/" rel="nofollow" title="Wired Relates Playboy Playmate BMI and Average BMI, 1954-2008 | FlowingData" >Wired Relates Playboy Playmate BMI and Average BMI, 1954-2008</a> on the FlowingData blog.</p>
<p align="center"><img src="http://peltiertech.com/images/2009-02/playmate_loess.png" alt="Playmate BMI over time" /></p>
<p><strong>The LOESS Function</strong></p>
<pre class="vbasmall">Public Function LOESS(X As Variant, Y As Variant, xDomain As Variant, nPts As Long) As Double()
  Dim i As Long
  Dim iMin As Long
  Dim iMax As Long
  Dim iPoint As Long
  Dim iMx As Long
  Dim mx As Variant
  Dim maxDist As Double
  Dim SumWts As Double, SumWtX As Double, SumWtX2 As Double, SumWtY As Double, SumWtXY As Double
  Dim Denom As Double, WLRSlope As Double, WLRIntercept As Double
  Dim xNow As Double
  Dim distance() As Double
  Dim weight() As Double
  Dim yLoess() As Double

  If TypeName(X) = "Range" Then
    X = X.Value
  End If

  If TypeName(Y) = "Range" Then
    Y = Y.Value
  End If

  If TypeName(xDomain) = "Range" Then
    xDomain = xDomain.Value
  End If

  ReDim yLoess(LBound(xDomain, 1) To UBound(xDomain, 1), 1 To 1)

  For iPoint = LBound(xDomain, 1) To UBound(xDomain, 1)

    iMin = LBound(X, 1)
    iMax = UBound(X, 1)

    xNow = xDomain(iPoint, 1)

    ReDim distance(iMin To iMax)
    ReDim weight(iMin To iMax)

    For i = iMin To iMax
      ' populate x, y, distance
      distance(i) = Abs(X(i, 1) - xNow)
    Next

    Do
      ' find the nPts points closest to xNow
      If iMax + 1 - iMin &lt;= nPts Then Exit Do
      If distance(iMin) &gt; distance(iMax) Then
        ' remove first point
        iMin = iMin + 1
      ElseIf distance(iMin) &lt; distance(iMax) Then
        ' remove last point
        iMax = iMax - 1
      Else
        ' remove both points?
        iMin = iMin + 1
        iMax = iMax - 1
      End If
    Loop

    ' Find max distance
    maxDist = -1
    For i = iMin To iMax
      If distance(i) &gt; maxDist Then maxDist = distance(i)
    Next

    ' calculate weights using scaled distances
    For i = iMin To iMax
      weight(i) = (1 - (distance(i) / maxDist) ^ 3) ^ 3
    Next

    ' do the sums of squares
    SumWts = 0
    SumWtX = 0
    SumWtX2 = 0
    SumWtY = 0
    SumWtXY = 0
    For i = iMin To iMax
      SumWts = SumWts + weight(i)
      SumWtX = SumWtX + X(i, 1) * weight(i)
      SumWtX2 = SumWtX2 + (X(i, 1) ^ 2) * weight(i)
      SumWtY = SumWtY + Y(i, 1) * weight(i)
      SumWtXY = SumWtXY + X(i, 1) * Y(i, 1) * weight(i)
    Next
    Denom = SumWts * SumWtX2 - SumWtX ^ 2

    ' calculate the regression coefficients, and finally the loess value
    WLRSlope = (SumWts * SumWtXY - SumWtX * SumWtY) / Denom
    WLRIntercept = (SumWtX2 * SumWtY - SumWtX * SumWtXY) / Denom
    yLoess(iPoint, 1) = WLRSlope * xNow + WLRIntercept

  Next

  LOESS = yLoess

End Function
 </pre>
<p><strong>The LOESS Utility</strong></p>
<p>The flexibility of this LOESS function will make it easy to encapsulate into an add-in that uses a dialog to facilitate user selection of data and parameters. A working version uses the following dialog:</p>
<p align="center"><img src="http://peltiertech.com/images/2009-03/LOESS_dialog.png" alt="Dialog for LOESS Utility" /></p>
<p><em><strong>Update 24 June 2009</strong></em></p>
<p><em>A LOESS utility for Excel has finally been made ready for public consumption. It is described in <a href="http://peltiertech.com/WordPress/loess-utility-for-excel/"title="LOESS Utility for Excel" >LOESS Utility for Excel</a>, where there is a link to download the utility. It&#8217;s still in preliminary form, but runs pretty much trouble free. Users are encouraged to comment on it to drive further development.</em></p>
<p><em><strong>Update 8 October 2009</strong></em></p>
<p><em>The LOESS utility for Excel has been updated, and the interface made more flexible. It is described in <a href="http://peltiertech.com/WordPress/loess-utility-awesome-update/"title="LOESS Utility – Awesome Update | PTS Blog" >LOESS Utility – Awesome Update</a>, where there is a link to download the new utility.</em></p>
<p><strong>References</strong></p>
<p>Cleveland, W.S. (1979), &#8220;Robust Locally Weighted Regression and Smoothing Scatterplots,&#8221; <em>Journal of the American Statistical Association</em>,  Vol. 74, pp. 829-836.</p>
<p>Cleveland, W.S. and Devlin, S.J. (1988), &#8220;Locally Weighted Regression: An Approach to Regression Analysis by Local Fitting,&#8221; Journal of the American Statistical Association, Vol. 83, pp. 596-610.</p>
<p>NIST Engineering Statistics Handbook, <a href="http://www.itl.nist.gov/div898/handbook/pmd/section1/pmd144.htm" rel="nofollow" title="NIST Engineering Statistics Handbook | 4.1.4.4. LOESS" >4.1.4.4. LOESS (aka LOWESS)</a></p>
<p>NIST Engineering Statistics Handbook, <a href="http://www.itl.nist.gov/div898/handbook/pmd/section1/dep/dep144.htm" rel="nofollow" title="NIST Engineering Statistics Handbook | Example of LOESS Computations" >Example of LOESS Computations</a></p>
<p>Wikipedia, <a href="http://en.wikipedia.org/wiki/Local_regression" rel="nofollow" title="Local Regression on Wikipedia" >Local regression</a></p>
<p>Peltier Technical Services, Inc., Copyright © 2010.<br /> <br /><span style="font: 80% Verdana,Tahoma,Arial,sans-serif;">Licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow" rel="license" >Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.<br /> <br />
<a href="http://www.exceluser.com/cmd.asp?Clk=2474005" rel="nofollow" ><IMG SRC="http://www.exceluser.com/images/info/pub/pnp468_01.jpg" ALT="Create Excel dashboards quickly with Plug-N-Play reports." WIDTH="468" HEIGHT="60" border=0></a><br />
<br /><img src="http://www.exceluser.com/cmd.asp?Imp=2474005" width="0" height="0" border="0"></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://twitter.com/home?status=LOESS%20Smoothing%20in%20Excel%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel&amp;bodytext=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;t=LOESS%20Smoothing%20in%20Excel" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel&amp;source=Peltier+Tech+Blog+Peltier+Tech+Excel+Charts+and+Programming+Blog&amp;summary=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel&amp;notes=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel&amp;annotation=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;title=LOESS%20Smoothing%20in%20Excel" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;t=LOESS%20Smoothing%20in%20Excel" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=LOESS%20Smoothing%20in%20Excel&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;submitHeadline=LOESS%20Smoothing%20in%20Excel&amp;submitSummary=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Floess-smoothing-in-excel%2F&amp;t=LOESS%20Smoothing%20in%20Excel&amp;s=In%201979%20William%20Cleveland%20published%20the%20LOESS%20%28or%20LOWESS%29%20technique%20for%20smoothing%20data%2C%20and%20in%201988%20he%20and%20Susan%20J.%20Devlin%20published%20a%20refined%20version%20of%20the%20technique%20%28references%20are%20given%20at%20the%20end%20of%20this%20article%29.%20For%20each%20X%20value%20where%20a%20Y%20valu" title="Tumblr"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/loess-smoothing-in-excel/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>How to Edit Series Formulas</title>
		<link>http://peltiertech.com/WordPress/how-to-edit-series-formulas/</link>
		<comments>http://peltiertech.com/WordPress/how-to-edit-series-formulas/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 16:00:55 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[series formula]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=1254</guid>
		<description><![CDATA[Ever have a situation where you have spent time getting your chart or charts to look nice, then try to use different data ranges in these charts? You&#8217;ve discovered that there&#8217;s no easy way to approach this change. At least there&#8217;s no easy way built into Excel, but there is a utility that can make [...]]]></description>
			<content:encoded><![CDATA[<p>Ever have a situation where you have spent time getting your chart or charts to look nice, then try to use different data ranges in these charts? You&#8217;ve discovered that there&#8217;s no easy way to approach this change. At least there&#8217;s no easy way built into Excel, but there is a utility that can make the task easier.</p>
<p><strong>Scenario 1<br />
 </strong></p>
<p>You&#8217;ve made a gorgeous chart of the data in Sheet1. You copied the chart from Sheet1 to Sheet2 so you could plot Sheet2&#8217;s data in the same splendor. And you hit a snag: the chart on Sheet2 refers back to Sheet1&#8217;s data. There are two ways to correct this:</p>
<ul style="margin-left: 24px;">
<li>Create a copy of Sheet1 including the chart, so the chart on the copied sheet refers to the data on the copied sheet. Then copy Sheet2&#8217;s data and paste it over the copied sheet&#8217;s data.</li>
<li>Edit the series formulas of the copied chart in Sheet2, changing all instances of one sheet name to the other. This becomes tedious if there are multiple series in the copied chart, or if you&#8217;ve copied multiple charts.</li>
</ul>
<p><span id="more-1254"></span><strong>Scenario 2</strong></p>
<p>You&#8217;ve charted data in rows 1 to 100 of your worksheet. Then you&#8217;ve updated the data so it reaches down to row 150. Your wonderful chart only shows data down to row 100. There are three ways to correct this:</p>
<ul style="margin-left: 24px;">
<li>Before updating the data, convert the data range to a List (Excel 2003) or a Table (Excel 2007). Then update the data. The list/table will expand to include all of the data, and all formulas that refer to all rows in the list/table will update accordingly. This includes the chart&#8217;s SERIES formula.</li>
<li>Create dynamic named ranges for the X and Y data ranges in the chart, and apply them to the chart series. This is described in <a href="http://peltiertech.com/WordPress/2008/05/14/dynamic-charts/"class="simple_alink" title="Dynamic Charts" >Dynamic Charts</a> in this blog and in a number of <a href="http://peltiertech.com/Excel/Charts/Dynamics.html" rel="nofollow" >Dynamic and Interactive Chart</a> examples described in this web site. However, this is an involved procedure that you never have time for.</li>
<li>Edit the series formulas of the chart, changing all instances of one row number to another. This becomes tedious if there are multiple series&nbsp; or multiple charts to correct.</li>
</ul>
<p><strong>Scenario 3</strong></p>
<p>Your charts show the data for product Alpha beautifully, but you want to show the data for product Beta instead. The data is listed in another column. You can:</p>
<ul style="margin-left: 24px;">
<li>Select the series, then drag the highlighted rectangles on the worksheet to reflect the new data range. This becomes a laborious process for multiple charts and series. </li>
<li>Edit the series formulas of the chart, changing all instances of one column to another. This becomes tedious if there are multiple series&nbsp; or multiple charts to correct.</li>
</ul>
<p><strong>The Solution</strong></p>
<p>These suggested means for editing your charts all leave out one approach. In <a href="http://peltiertech.com/Excel/Charts/ChgSrsFmla.html" rel="nofollow" title="Change Series Formulas" >Change Series Formulas</a> I showed how to programmatically change the series formulas in your charts, and I provided a utility that does the task for you. I&#8217;ve just recently updated the utility to account for glitches in Excel, and to streamline using the utility.</p>
<h2 style="margin: 0pt 0pt 18px; font-size: 1em;">The Change Series Formula Utility</h2>
<p>The new utility is located in <a href="http://peltiertech.com/images/2008-12/PTS_ChangeSeriesFormula.zip" rel="nofollow" title="PTS Change Series Formula Utility" >PTS_ChangeSeriesFormula.zip</a>. You can install it following the protocol in <a href="http://peltiertech.com/WordPress/2008/06/07/installing-an-excel-add-in/"title="Installing an Excel Add-In" >Installing an Excel Add-In</a>.</p>
<p>Upon installation, the utility creates a toolbar (In Excel 2007, the toolbar buttons are buried on the Add-Ins tab of the ribbon).</p>
<p align="center"><img title="Change Series Formula Toolbar" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaToolbar.png" alt="Change Series Formula Toolbar" /></p>
<p>Not too fancy or complicated. Suppose I have the following scenario, a chart showing data for Alpha in column B, and I want to show Beta from column C instead.</p>
<p align="center"><img title="Change Series Formula Chart - Before" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaChart1a.png" alt="Change Series Formula Chart - Before" /></p>
<p>If it&#8217;s only one series in one chart, I can drag the colored highlight rectangles in the sheet, or edit the series formula in the formula bar. But if there&#8217;s more, why waste time? With the chart selected (I like to select the series, so the formula bar is visible and I don&#8217;t have to remember what to change), click on the <em>Change Series Formula</em> button on the toolbar. Enter the old and new text in the dialog. In the old text entry box, I like to explicitly use punctuation like the dollar signs, to make sure I&#8217;m changing a column designation and not some other text in the formula. In the new text box, it doesn&#8217;t matter, because Excel capitalizes and adds dollar signs automatically.</p>
<p align="center"><img title="Change Series Formula Dialog" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaDialog1.png" alt="Change Series Formula Dialog" /></p>
<p>Click the <em>Change Active Chart Only</em> button (the other button is inactive because there are no other charts on this worksheet).</p>
<p>Magically, the series formula, the colored highlights, and the chart itself now reference the new data.</p>
<p align="center"><img title="Change Series Formula Chart - After" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaChart1b.png" alt="Change Series Formula Chart - After" /></p>
<p>Here is how I would extend a chart&#8217;s data from row 6 to row 12. In this case there are multiple charts on the worksheet, and you have a choice of changing the active chart or changing all charts on the worksheet.</p>
<p align="center"><img title="Change Series Formula Dialog" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaDialog2.png" alt="Change Series Formula Dialog" /></p>
<p>This dialog shows how to change references from Sheet1 to Sheet2. In addition, the buttons reflect that multiple charts have been selected using Shift+Click. The options are to change all selected charts or all charts on the worksheet.</p>
<p align="center"><img title="Change Series Formula Dialog" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaDialog3.png" alt="Change Series Formula Dialog" /></p>
<p>It&#8217;s a pretty smart utility, and it has saved me tons of time. Download it, install it, and use it. Give me feedback, make suggestions, and report errors in a comment below.</p>
<p>Peltier Technical Services, Inc., Copyright © 2010.<br /> <br /><span style="font: 80% Verdana,Tahoma,Arial,sans-serif;">Licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow" rel="license" >Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.<br /> <br />
<a href="http://www.exceluser.com/cmd.asp?Clk=2474005" rel="nofollow" ><IMG SRC="http://www.exceluser.com/images/info/pub/pnp468_01.jpg" ALT="Create Excel dashboards quickly with Plug-N-Play reports." WIDTH="468" HEIGHT="60" border=0></a><br />
<br /><img src="http://www.exceluser.com/cmd.asp?Imp=2474005" width="0" height="0" border="0"></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://twitter.com/home?status=How%20to%20Edit%20Series%20Formulas%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas&amp;bodytext=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;t=How%20to%20Edit%20Series%20Formulas" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas&amp;source=Peltier+Tech+Blog+Peltier+Tech+Excel+Charts+and+Programming+Blog&amp;summary=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas&amp;notes=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas&amp;annotation=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;title=How%20to%20Edit%20Series%20Formulas" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;t=How%20to%20Edit%20Series%20Formulas" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=How%20to%20Edit%20Series%20Formulas&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;submitHeadline=How%20to%20Edit%20Series%20Formulas&amp;submitSummary=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fhow-to-edit-series-formulas%2F&amp;t=How%20to%20Edit%20Series%20Formulas&amp;s=Ever%20have%20a%20situation%20where%20you%20have%20spent%20time%20getting%20your%20chart%20or%20charts%20to%20look%20nice%2C%20then%20try%20to%20use%20different%20data%20ranges%20in%20these%20charts%3F%20You%27ve%20discovered%20that%20there%27s%20no%20easy%20way%20to%20approach%20this%20change.%20At%20least%20there%27s%20no%20easy%20way%20built%20i" title="Tumblr"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/how-to-edit-series-formulas/feed/</wfw:commentRss>
		<slash:comments>71</slash:comments>
		</item>
		<item>
		<title>SOLVER &#8211; Optimization Approach to a Simple Physics Problem</title>
		<link>http://peltiertech.com/WordPress/solver-optimization-approach-to-a-simple-physics-problem/</link>
		<comments>http://peltiertech.com/WordPress/solver-optimization-approach-to-a-simple-physics-problem/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 01:29:12 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Data Techniques]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[Regression]]></category>
		<category><![CDATA[Science & Engineering]]></category>
		<category><![CDATA[Trendlines]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=511</guid>
		<description><![CDATA[In Graphical Approach to a Simple Physics Problem and Regression Approach to a Simple Physics Problem I have discussed approaches to solving my daughter&#8217;s physics homework. Basically, the problem started with this data, showing the time to drain water through a hole in a bucket, based on the diameter of the hole and the initial [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://peltiertech.com/WordPress/2008/09/08/graphical-approach-to-a-simple-physics-problem/"title="Graphical Approach to a Simple Physics Problem" >Graphical Approach to a Simple Physics Problem</a> and <a href="http://peltiertech.com/WordPress/2008/09/10/regression-approach-to-a-simple-physics-problem/"title="Regression Approach to a Simple Physics Problem" >Regression Approach to a Simple Physics Problem</a> I have discussed approaches to solving my daughter&#8217;s physics homework. Basically, the problem started with this data, showing the time to drain water through a hole in a bucket, based on the diameter of the hole and the initial height of water in the bucket.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/physdata1.png" alt="physics problem data" /></p>
<p>In the earlier two posts, I found that the drainage time was related to hole diameter through a power law relationship with an exponent of -2, and to height with an exponent of 1/2.</p>
<p align="center"><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/phys4a.png" alt="physics problem chart" /><img title="physics problem chart" src="http://peltiertech.com/WordPress/wp-content/img200809/phys4b.png" alt="physics problem chart" /></p>
<p>Often when modeling a physical process you have theoretical relationships that describe the process, and you just need to find the appropriate factors in the formula. Then you can manually plug and chug to find these factors, or you can use an analytical tool to find them.</p>
<p>In <a href="http://peltiertech.com/WordPress/goal-seek-optimization-approach-to-a-simple-physics-problem/"title="Goal Seek - Optimization Approach to a Simple Physics Problem" >Goal Seek &#8211; Optimization Approach to a Simple Physics Problem</a> I showed how to use the built-in Goal Seek optimization tool to determine the coefficient to the power law function involving initial water height and hole diameter. Excel has another tool, an optional add-in called <strong>SOLVER</strong>, which is a more powerful optimization tool.</p>
<p>I have set up my data as shown below. The initial data is in C9:F12. In C3:F6 I have calculated values for a formula of the form</p>
<pre class="vba">t = K * h<sup>a</sup> * d<sup>b</sup>
 </pre>
<p>where t is time to drain the bucket, h is the water height, d is hole diameter, K is the unknown coefficient, a is the exponent -2, and b is the exponent 0.5. I put a provisional factor K in cell A1, based on the preliminary regression work. Cell C3 has this formula, which is copied into the whole range C3:F6:</p>
<pre class="vba">=$A$1*C$2^0.5/$B3^2
 </pre>
<p>Finally, C15:F18 tabulates the squared differences between the calculations and the actual data. The formula in C15 is simply</p>
<pre class="vba">=(C3-C9)^2
 </pre>
<p>Cell A16 contains the sum of all of these differences (sum of squares). This is more routinely used than the simple sum of differences used in the Goal Seek approach, but the final answers are close.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver01.png" alt="physics problem data" /></p>
<p>I used SOLVER to minimize the sum of the squared differences in A16 by changing the factor in cell A1. Unlike Goal Seek, SOLVER actually does find a minimum.</p>
<p>From the Tools menu, choose SOLVER (in Excel 2007, on the Data ribbon tab, click on Solver in the Analysis group). If the command for SOLVER is unavailable, you will have to install it. See <a href="http://peltiertech.com/WordPress/2008/06/07/installing-an-excel-add-in/"title="Installing an Excel Add-In" >Installing an Excel Add-In</a> for instructions; the SOLVER add-in is either present in the list on the Add-Ins dialog, or you can click the Browse button and look in the SOLVER folder.</p>
<p>The following dialog allows you to indicate which cell to change in order to set another cell to a particular value. We are not using the powerful capabilities of SOLVER to include constraints in the model.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver02.png" alt="physics problem data" /></p>
<p>Click OK, and SOLVER does its magic, and shows a dialog which either shows a solution or explains why no solution was found. SOLVER did find a solution to this problem.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver03.png" alt="physics problem data" /></p>
<p>Here is the complete SOLVER solution.</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver04.png" alt="physics problem data" /></p>
<p>These charts show the SOLVER solution (markers and dotted lines) in comparison to the original data (solid lines).</p>
<p align="center"><img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver05.png" alt="physics problem data" /> <img title="physics problem data" src="http://peltiertech.com/WordPress/wp-content/img200809/solver06.png" alt="physics problem data" /></p>



Bookmark and share this entry:


	<a rel="nofollow"  href="http://twitter.com/home?status=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem%20-%20http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F" title="Twitter"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;bodytext=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate" title="Digg"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;t=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="Facebook"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;source=Peltier+Tech+Blog+Peltier+Tech+Excel+Charts+and+Programming+Blog&amp;summary=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate" title="LinkedIn"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;notes=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate" title="del.icio.us"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F" title="Technorati"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="StumbleUpon"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;annotation=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate" title="Google Bookmarks"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="Reddit"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;t=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem" title="MySpace"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://slashdot.org/bookmark.pl?title=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;url=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F" title="Slashdot"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;submitHeadline=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;submitSummary=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fpeltiertech.com%2FWordPress%2Fsolver-optimization-approach-to-a-simple-physics-problem%2F&amp;t=SOLVER%20-%20Optimization%20Approach%20to%20a%20Simple%20Physics%20Problem&amp;s=In%20Graphical%20Approach%20to%20a%20Simple%20Physics%20Problem%20and%20Regression%20Approach%20to%20a%20Simple%20Physics%20Problem%20I%20have%20discussed%20approaches%20to%20solving%20my%20daughter%27s%20physics%20homework.%20Basically%2C%20the%20problem%20started%20with%20this%20data%2C%20showing%20the%20time%20to%20drain%20wate" title="Tumblr"><img src="http://peltiertech.com/WordPress/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/solver-optimization-approach-to-a-simple-physics-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
