<?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; Utilities</title>
	<atom:link href="http://peltiertech.com/WordPress/category/utilities/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress</link>
	<description>Peltier Tech Excel Charts and Programming Blog</description>
	<lastBuildDate>Tue, 07 Feb 2012 14:40:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Upgraded Panel Chart Utility</title>
		<link>http://peltiertech.com/WordPress/upgraded-panel-chart-utility/</link>
		<comments>http://peltiertech.com/WordPress/upgraded-panel-chart-utility/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 21:40:50 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=3280</guid>
		<description><![CDATA[After weeks of testing and feedback on the Peltier Tech Panel Chart Utility, it was time to implement the bar chart option. It took a day of coding In Excel 2003, a half day of testing and swearing in Excel 2007 (don&#8217;t let&#8217;s get started on that), and a half day of implementing workarounds for Excel 2007. [...]]]></description>
			<content:encoded><![CDATA[<p>After weeks of testing and feedback on the <a href="http://peltiertech.com/Utility/PanelChartUtility.html" rel="nofollow" title="Peltier Tech Panel Chart Utility" >Peltier Tech Panel Chart Utility</a>, it was time to implement the bar chart option. It took a day of coding In Excel 2003, a half day of testing and swearing in Excel 2007 (don&#8217;t let&#8217;s get started on that), and a half day of implementing workarounds for Excel 2007. Plus a half day rewriting the documentation on the site.</p>
<p>And the result is an incredible upgrade, not just in available chart type options (huge in itself), but in formatting, user formatting options, stability, and speed of execution. This image illustrates the chart types available to the new panel chart utility:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-04/Panel2007DotBar.gif" alt="Peltier Tech's Panel Chart Utility Makes Dot Plots and Bar Charts" /></p>
<p><span id="more-3280"></span></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 18px; margin-left: 0px; padding: 0px;">They don&#8217;t flash back and forth like that, but almost.</p>
<h2>Peltier Tech Panel Chart Utility Dialog</h2>
<p>A peek at the dialog shows some of the areas of improvement. The top 30mm and bottom 15 mm of the dialog are unchanged, but in between are 61 mm of great new stuff.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-04/PanelDialog.png" alt="Peltier Tech Panel Chart Utility Dialog" /></p>
<p>The sorting capability that appears just below the data section of the dialog has been added in the past several weeks, and has been available to users. In addition to the original sort, which arranged panels from lowest average value in the bottom left to highest in the top right, there are also options to sort alphabetically and to skip sorting. This is still not flexible enough, so in coming weeks, the utility will get a redesigned sort functionality.</p>
<p>The next section is the biggie: they&#8217;re not just dot plots anymore, you can have bar charts as well. This took most of the effort but provides most of the payoff.</p>
<p>The last new feature has also been kicking around for a few weeks. The original utility figured out how many panels you needed, and computed grid dimensions to fit. In the meantime, users reported that they&#8217;d like to have control over the shape (aspect ratio, rows vs. columns) in their charts. You can now override the default shape of the panel chart.</p>
<h2>Peltier Tech Panel Chart Utility Output Region</h2>
<p>Here&#8217;s a look at the updated output region. There are a few noteworthy elements.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-04/PanelOutput.png" alt="Output of Peltier Tech Panel Chart Utility" /></p>
<h2>Dynamic Panel Chart Styles</h2>
<p>Most prominent is a listbox next to the chart, which lists the two chart styles and highlights the selected style. The listbox is there to make the chart style dynamic. With hardly any effort on the user&#8217;s part, the chart can change from Dot Plot. . .</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-04/PanelDotListbox.png" alt="Peltier Tech Panel Chart Utility's Dot Plot" /></p>
<p>. . . to Bar Chart. . .</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-04/PanelBarListbox.png" alt="Peltier Tech Panel Chart Utility's Bar Chart" /></p>
<p>. . . and back. And because it&#8217;s done using official Peltier Tech Smoke and Mirrors, when you format (say) the bars, change to a dot plot, then change it back to bars, any formatting you&#8217;ve applied is remembered, so you don&#8217;t need to utter any oaths while reapplying the format.</p>
<h2>Interactive Axis Scale and Number Format</h2>
<p>Further to the left is a green shaded region, which allows the user to adjust the horizontal axis scale. Although the utility calculates good axis scale parameters, it cannot read the user&#8217;s mind. Since the scale cannot be set using Excel&#8217;s normal Format Axis dialog, this shaded region provides the capability.</p>
<p>What is new is the ability to enter a custom number format. For example, if the variable is in units of time, you could enter h:mm in the appropriate cell.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-04/PanelOutputOverrider.png" alt="Peltier Tech Panel Chart Utility's Output Override Area" /></p>
<h2>Details About the Peltier Tech Panel Chart Utility</h2>
<p>If you want to see more about how this utility works, you can read the documentation at <a href="http://peltiertech.com/Utility/PanelChartUtilityDocs.html" rel="nofollow" title="PTS Panel Chart Utility Documentation" >Peltier Tech Panel Chart Utility Documentation</a>. For information about purchasing a license (or bulk licenses) visit the <a href="http://peltiertech.com/Utility/PanelChartUtility.html" rel="nofollow" title="Peltier Tech Panel Chart Utility" >Peltier Tech Panel Chart Utility</a> page. And if you&#8217;ve already licensed this utility, send me an email and I&#8217;ll send you a link to the new setup file.</p>
<p>Peltier Technical Services, Inc., Copyright © 2011.<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://peltiertech.com/Utility/" rel="nofollow"  title="PTS Chart Utilities: Waterfall, Cluster-Stack Column, Box and Whisker, Marimekko"><img src="http://peltiertech.com/Utility/pix/pts_banner_map.png" alt="PTS Chart Utilities: Waterfall, Box and Whisker, Cluster-Stack, Panel, Marimekko, Dot, Panel" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/upgraded-panel-chart-utility/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Change Series Formula &#8211; Improved Routines</title>
		<link>http://peltiertech.com/WordPress/change-series-formula-improved-routines/</link>
		<comments>http://peltiertech.com/WordPress/change-series-formula-improved-routines/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 20:48:41 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=3275</guid>
		<description><![CDATA[Ever make a copy of a chart, and all you want is do is change the worksheet containing the source data? Or change the X values of all series from column A to column B? It sure is a pain to edit each series&#8217; source data range of series formula one by one. The series [...]]]></description>
			<content:encoded><![CDATA[<p>Ever make a copy of a chart, and all you want is do is change the worksheet containing the source data?  Or change the X values of all series from column A to column B?  It sure is a pain to edit each series&#8217; source data range of series formula one by one.</p>
<p>The series formula is a simple text string, but there&#8217;s no Search and Replace feature in Excel that can access these formulas.  But you can use some very simple VBA code to make wholesale changes to chart series formulas. Or you can skip all of the noise, scroll to the end of this article, and download the new Change Series Formula Utility.</p>
<h2>About the Chart Series Formula</h2>
<p>A more detailed description of a chart and its series formula is presented in <a href="http://peltiertech.com/Excel/ChartsHowTo/ChartSeriesFormula.html" rel="nofollow" title="The Chart Series Formula" >The Chart Series Formula</a> and <a href="http://peltiertech.com/WordPress/2008/12/17/how-to-edit-series-formulas/"title="How to Edit Series Formulas" >How to Edit Series Formulas</a> elsewhere on this site, but a brief description here is in order.</p>
<p><span id="more-3275"></span>Every chart series has a formula which describes the data in the series.  The simple chart in this example is shown below its data range; the series is selected to highlight the data used to plot the series and to show the <tt class="tt">SERIES</tt> formula in the formula bar.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaExample.png" alt="Series selected=" /></p>
<pre class="vbasmall"><code>=SERIES(Sheet1!$B$1,Sheet1!$A$2:$A$11,Sheet1!$B$2:$B$11,1)</code></pre>
<p>This formula can be broken up into four elements as follows:</p>
<pre class="vbasmall"><code>=SERIES([Series Name],[X Values],[Y Values],[Plot Order])</code></pre>
<p>In our example:</p>
<pre class="vbasmall"><code>=SERIES(<strong><span style="color: #0000ff;">Sheet1!$B$1</span></strong>,Sheet1!$A$2:$A$11,Sheet1!$B$2:$B$11,1)</code></pre>
<p><tt class="tt"><span style="color: #0000ff;">Sheet1!$B$1</span></tt> contains the Series Name</p>
<pre class="vbasmall"><code>=SERIES(Sheet1!$B$1,<strong><span style="color: #0000ff;">Sheet1!$A$2:$A$11</span></strong>,Sheet1!$B$2:$B$11,1)</code></pre>
<p><tt class="tt"><span style="color: #0000ff;">Sheet1!$A$2:$A$11</span></tt> contains the X Values or Category Labels</p>
<pre class="vbasmall"><code>=SERIES(Sheet1!$B$1,Sheet1!$A$2:$A$11,<strong><span style="color: #0000ff;">Sheet1!$B$2:$B$11</span></strong>,1)</code></pre>
<p><tt class="tt"><span style="color: #0000ff;">Sheet1!$B$2:$B$11</span></tt> contains the Y Values</p>
<pre class="vbasmall"><code>=SERIES(Sheet1!$B$1,Sheet1!$A$2:$A$11,Sheet1!$B$2:$B$11,<strong><span style="color: #0000ff;">1</span></strong>)</code></pre>
<p>and the series is plotted first <tt class="tt">(<span style="color: #0000ff;"><strong>1</strong></span>)</tt> among the chart&#8217;s series collection.</p>
<p>The <tt class="tt">Series Name</tt> can be blank, a text string in double quotation marks, a reference to a worksheet range (one or more cells), or a reference to a named range (named formula).  The <tt class="tt">X Values</tt> can be blank, a literal array of numeric values or text labels enclosed in curly braces, a reference to a worksheet range (one or more cells), or a reference to a named range (named formula).  The <tt class="tt">Y Values</tt> can be a literal array of numeric values enclosed in curly braces, a reference to a worksheet range (one or more cells), or a reference to a named range (named formula).  The <tt class="tt">Plot Order</tt> can only be a whole number between 1 and the number of series in the chart.</p>
<h2>Editing the Series Formula</h2>
<p>The series formula is a text-based Excel formula like any other.  You can click in the formula bar, and edit the formula manually, to change aspects of the charted series.  Select part or all of the formula, type in the text you want there instead, and press Enter to apply the changes (or sometimes to cause an error!).  Alternatively you can select one range address in the formula, then click and drag with the mouse to insert the address of another range in the worksheet.</p>
<p>But if you have to do this for every series in your chart, and every chart on the worksheet, you will be editing in the formula bar all day.  So let&#8217;s make VBA do some of the tedious work for us.</p>
<h2>Editing the Series Formula with VBA</h2>
<p>The meat of this technique involves this very simple VBA command:</p>
<pre class="vbasmall"><code>Series.Formula = WorksheetFunction.Substitute(Series.Formula, OldString, NewString)</code></pre>
<p>Basically, <tt class="tt">Substitute</tt> works by replacing every instance of <tt class="tt">OldString</tt> in the input text string (<tt class="tt">Series.Formula</tt>) by <tt class="tt">NewString</tt>.  You could use <tt class="tt">Replace</tt> instead of <tt class="tt">WorksheetFunction.Substitute</tt>, but this would not be compatible with Excel 97.</p>
<p>There are a few tricks I&#8217;ve learned to improve the reliability of this technique.  First, <tt class="tt">OldString</tt> should be entered using the same case as is found in the formula.  For example, &#8220;b&#8221; will not find any references to column B in the formula.  Second, to make sure you don&#8217;t trash any worksheet name in the formula, use &#8220;$C$&#8221; rather than &#8220;C&#8221; if you are replacing references to column C.</p>
<p>In the simplest version of this utility, you can use a couple input boxes to ask the user for <tt class="tt">OldString</tt> and <tt class="tt">NewString</tt>.  A little error trapping makes sure that there is an active chart and that <tt class="tt">OldString</tt> is valid.</p>
<h3>Program to Modify the Active Chart</h3>
<pre class="vbasmall"><code>Sub ChangeSeriesFormula()
    ''' Just do active chart
    If ActiveChart Is Nothing Then
        '' There is no active chart
        MsgBox "Please select a chart and try again.", vbExclamation, _
            "No Chart Selected"
        Exit Sub
    End If

    Dim OldString As String, NewString As String, strTemp As String
    Dim mySrs As Series

    OldString = InputBox("Enter the string to be replaced:", "Enter old string")

    If Len(OldString) &gt; 1 Then
        NewString= InputBox("Enter the string to replace " &amp; """" _
            &amp; OldString &amp; """:", "Enter new string")
        '' Loop through all series
        For Each mySrs In ActiveChart.SeriesCollection
            <span style="color: #0000ff;">strTemp = WorksheetFunction.Substitute(mySrs.Formula, OldString, NewString)</span>
            mySrs.Formula = strTemp
        Next
    Else
        MsgBox "Nothing to be replaced.", vbInformation, "Nothing Entered"
    End If
End Sub</code></pre>
<h3>Program to Modify All Charts on the Active Sheet</h3>
<p>Adding another loop to iterate through a sheet&#8217;s chart objects will change every chart on the sheet.</p>
<pre class="vbasmall"><code>Sub ChangeSeriesFormulaAllCharts()
    ''' Do all charts in sheet
    Dim oChart As ChartObject
    Dim OldString As String, NewString As String
    Dim mySrs As Series

    OldString = InputBox("Enter the string to be replaced:", "Enter old string")

    If Len(OldString) &gt; 1 Then
        NewString = InputBox("Enter the string to replace " &amp; """" _
            &amp; OldString &amp; """:", "Enter new string")
        <span style="color: #0000ff;">For Each oChart In ActiveSheet.ChartObjects</span>
            For Each mySrs In oChart.Chart.SeriesCollection
                mySrs.Formula = WorksheetFunction.Substitute(mySrs.Formula, OldString, NewString)
            Next
        <span style="color: #0000ff;">Next</span>
    Else
        MsgBox "Nothing to be replaced.", vbInformation, "Nothing Entered"
    End If
End Sub</code></pre>
<h2>How the program works</h2>
<p>Here is our chart again, bet we&#8217;ve got an extra column of data. The chart shows column B plotted, but we want to plot column C instead.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaExample2.png" alt="Chart before changing series formula" /></p>
<p>Using the second version of the program above, all we need to do is run the code. I usually like to select one chart&#8217;s series, to remind me what string I want to change.</p>
<p>The program&#8217;s first input box asks for the string we want to replace ($B$ for column B):</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaOldString1.png" alt="Input box for old string" /></p>
<p>The second input box asks for the string we want to replace that string with (&#8220;c&#8221;):</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaNewString1.png" alt="Input box for new string" /></p>
<p>We see that the program has changed the series formula, while the chart now highlights the new range and shows the new data.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaExample3.png" alt="Chart after changing series formula" /></p>
<h2>Warning: Blank Line or XY Series</h2>
<p>When a line or XY series has no plottable points (that is, the data range has no numerical values to plot), VBA can&#8217;t read the formula. This example shows the problem.</p>
<p>We have no trouble changing the chart&#8217;s Y values from column B</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaXY1a.png" alt="Chart before changing series formula from column A to column B" /></p>
<p>to column C</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaXY2a.png" alt="Chart after changing series formula from column A to column B" /></p>
<p>even though column C has no data to plot. The chart merely looks blank, and we cannot select the series.</p>
<p>When we try to change from column C</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaOldString2.png" alt="Input box for old string" /></p>
<p>to column D</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaNewString2.png" alt="Input box for new string" /></p>
<p>Excel chokes, because it can&#8217;t read the series formula we want it to change.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaRTE1004.png" alt="Error message: Excel can't read the formula" /></p>
<p>Excel can&#8217;t read the formula for a line or XY series with no data, but fortunately it can read other types, so we can do just fine if we change the series temporarily to a column chart, edit the series, and change the series back. Here&#8217;s the code:</p>
<pre class="vbasmall"><code>Sub ChangeSeriesFormulaAllCharts()
    ''' Do all charts in sheet
    Dim oChart As ChartObject
    Dim OldString As String, NewString As String
    Dim mySrs As Series
    Dim iChartType As XlChartType
    Dim sFormula As String

    OldString = InputBox("Enter the string to be replaced:", "Enter old string")

    If Len(OldString) &gt; 1 Then
        NewString = InputBox("Enter the string to replace " &amp; """" _
            &amp; OldString &amp; """:", "Enter new string")
        For Each oChart In ActiveSheet.ChartObjects
            For Each mySrs In oChart.Chart.SeriesCollection
                sFormula = ""
                On Error Resume Next
                sFormula = mySrs.Formula
                On Error GoTo 0
                <span style="color: #0000ff;">' change to column chart if series is inaccessible</span>
                <span style="color: #0000ff;">If Len(sFormula) = 0 Then
                    iChartType = mySrs.ChartType
                    mySrs.ChartType = xlColumnClustered
                End If</span>
                mySrs.Formula = WorksheetFunction.Substitute(mySrs.Formula, OldString, NewString)
                <span style="color: #0000ff;">If Len(sFormula) = 0 Then mySrs.ChartType = iChartType</span>
            Next
        Next
    Else
        MsgBox "Nothing to be replaced.", vbInformation, "Nothing Entered"
    End If
End Sub</code></pre>
<p>The intermediate chart still looks blank, but if we are attentive we might notice the horizontal axis has changed from the typical XY value-style axis to a typical column category-style axis.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaXY2b.png" alt="Column chart before changing series formula from column B to column C" /></p>
<p>After the series is changed, the columns reflect the new values.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaXY3.png" alt="Column chart after changing series formula from column B to column C" /></p>
<p>Finally, the chart is reverted to its original XY style.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2011-03/SrsFmlaXY3a.png" alt="XY chart after changing series formula from column B to column C" /></p>
<h2>Warning: VBA Error</h2>
<p>If the X value argument of a series formula consists of a Name instead of an array or a range address, VBA incorrectly reads the series formula, by enclosing the Name in single quotes. When assigning a formula to a series with a Name as its X value argument, VBA fails whether or not the erroneous single quotes are included. This is apparently a bug in Excel VBA, and it has been reported to Microsoft. The utility below has been upgraded with a workaround to avoid this error.</p>
<p>Essentially the workaround involves checking for a Name in the X values argument of the formula, temporarily removing the argument altogether from the new series formula, then reassigning the Name using the <tt class="tt">Series.XValues</tt> property.</p>
<h2>The Change Series Formula Utility</h2>
<p>I&#8217;ve updated the utility to take into account the funny VBA behavior when Names are used in the formula, and the problem with XY and Line charts that have no data to plot. The updated utility is located in <a href="http://peltiertech.com/images/Zips/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><img style="display: block; margin-left: auto; margin-right: auto;" title="Change Series Formula Toolbar" src="http://peltiertech.com/images/2008-12/ChgSrsFmlaToolbar.png" alt="Change Series Formula Toolbar" /></p>
<p>This utility incorporates all of the editing code. In addition, it replaces the separate old and new text input boxes with a single dialog with two text boxes. It also has two buttons, which based on what is selected and active, allows you to change the active chart, change any charts which you&#8217;ve selected using Ctrl+Click, or change all charts on the active sheet. It also remembers the inputs in the two text boxes, so you can reuse them for charts on another worksheet. Here is the Change Series Formula dialog:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Change Series Formula Toolbar" src="http://peltiertech.com/images/2011-03/ChgSrsFmlaDialog.png" alt="Change Series Formula Dialog" /></p>
<p>Try this new utility, and please let me know if it doesn&#8217;t work in the comments below.</p>
<p>Peltier Technical Services, Inc., Copyright © 2011.<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://peltiertech.com/Utility/" rel="nofollow"  title="PTS Chart Utilities: Waterfall, Cluster-Stack Column, Box and Whisker, Marimekko"><img src="http://peltiertech.com/Utility/pix/pts_banner_map.png" alt="PTS Chart Utilities: Waterfall, Box and Whisker, Cluster-Stack, Panel, Marimekko, Dot, Panel" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/change-series-formula-improved-routines/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Trellis Plot Alternative to Stacked Bar Chart</title>
		<link>http://peltiertech.com/WordPress/trellis-plot-alternative-to-stacked-bar-chart/</link>
		<comments>http://peltiertech.com/WordPress/trellis-plot-alternative-to-stacked-bar-chart/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 07:00:13 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[Panel Chart]]></category>
		<category><![CDATA[Trellis Chart]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=3269</guid>
		<description><![CDATA[Trellis plots (aka panel charts) split plotted data series up into cells of a grid. The resulting small chart invoke the principle of small multiples by using the same axis scales. Putting series into separate mini-charts eliminates the clutter that occurs when too many points are plotted together in the same chart, while still displaying [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right; margin-left: 10px; margin-right: 10px;" src="http://peltiertech.com/images/2011-02/PartialChart.png" alt="" width="275" height="300" />Trellis plots (aka panel charts) split plotted data series up into cells of a grid. The resulting small chart invoke the principle of small multiples by using the same axis scales. Putting series into separate mini-charts eliminates the clutter that occurs when too many points are plotted together in the same chart, while still displaying comparisons and trends. In this post I revisit ineffective stacked bar charts, show better graphical display using bar- and dot-based panel charts, and finally show dot-based panel charts of this data produced with the new <a href="http://peltiertech.com/Utility/PanelChartUtility.html" rel="nofollow" title="Peltier Tech Panel Chart Utility" >Peltier Tech Panel Chart Utility</a>.</p>
<p><strong>The Original Chart and My Panel Charts</strong></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 18px; margin-left: 0px; padding: 0px;">Last year I proposed some <a href="http://peltiertech.com/WordPress/stacked-bar-chart-alternatives/"style="background-color: inherit; color: #286ea0; font-weight: bold; text-decoration: none; padding: 0px; margin: 0px;" title="Stacked Bar Chart Alternatives | Peltier Tech Blog" >alternatives to the stacked bar chart</a> used in a Gartner report to compare how BI programs were used by their customers. My alternatives included various panel bar charts. That was followed by a guest post by Naomi Robbins, who used <a href="http://peltiertech.com/WordPress/some-comments-on-dot-plots-guest-post/"style="background-color: inherit; color: #286ea0; font-weight: bold; text-decoration: none; padding: 0px; margin: 0px;" title="Some Comments on Dot Plots (Naomi Robbins) | Peltier Tech Blog" >panel dot plots</a> to show the same data.</p>
<p>The chart that kicked off the discussion was a stacked bar chart. Stacked charts have their difficulties, because only the bottom series and the total of all series share a common baseline among their points. The other series&#8217; points start wherever the lower series end, making comparisons more difficult. In this chart, the categories (vendors) are sorted from low to high by total score. but the series (activities) are unsorted.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Original Stacked Bar: How BI Customers Use Their Platforms" src="http://peltiertech.com/images/2010-03/Tableau-Gartner-stack-bar.png" alt="Original Stacked Bar: How BI Customers Use Their Platforms" /></p>
<p><span id="more-3269"></span>My contribution to the stacked bar chart genre was to sort the series, and to put the legend in the chart instead of under the chart, which made it somewhat easier to use.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Stacked Bar: How BI Customers Use Their Platforms" src="http://peltiertech.com/images/2010-03/tabgart3_bar_sorted.png" alt="Stacked Bar with Series Sorted by Decreasing Percentage: How BI Customers Use Their Platforms" /></p>
<p>I finally made a pair of panel bar charts, which is possible but a lot of tedious work in Excel.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Vendor Panel Chart: How BI Customers Use Their Platforms" src="http://peltiertech.com/images/2010-03/tabgart10_vendor_panel.png" alt="Vendor Panel Chart: How BI Customers Use Their Platforms" /></p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Vendor Panel Chart: How BI Customers Use Their Platforms" src="http://peltiertech.com/images/2010-03/tabgart10_vendor_panel2.png" alt="Vendor Panel Chart: How BI Customers Use Their Platforms" /></p>
<h2>Naomi Robbins&#8217; Trellis Dot Plots</h2>
<p>Naomi used the same data to make dot plots which are essentially equivalent to my last two bar charts.  She used S-Plus 6.2, an old version of S-Plus, to create the charts.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Dot Plot Trellis of BI Tasks by Vendor" src="http://peltiertech.com/images/2010-04/BIS-by-vendor.png" alt="Dot Plot Trellis of BI Tasks by Vendor" /></p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Dot Plot Trellis of BI Tasks by Vendor" src="http://peltiertech.com/images/2010-04/BIS-by-task.png" alt="Dot Plot Trellis of BI Vendors by Task" /></p>
<p>There is a slight difference in sorting between my charts and Naomi&#8217;s. I put the panel with the largest average values in the top left, with panels of decreasing average values to the right, moving to the next row down when I reached the end of a row. The convention used to draw most trellis plots is to put the panel with the lowest average values in the bottom left, with panels of increasing average values to the right, moving up a row when the end of a row is reached.</p>
<p>The standard trellis convention makes sense, since it puts the lowest values panel in the bottom left, close to the origin, and the highest values in the top right, furthest from the origin. If the data were to be presented without sorting, for instance in the order listed in an associated table, then the order I had used is probably easier for the reader to grasp.</p>
<h2>The Peltier Tech Panel Chart Utility</h2>
<p>S-Plus is a scripting language, which puts it out of reach of many potential users. Excel is more interactive, using the mouse- and keyboard-based graphical use interface, so it would be easier for &#8220;regular&#8221; users. Excel has a limited number of options for chart type. There are lots of glorious special effects charts available: 3D pies, bars, and columns, and oh yeah, cones, cylinders, and pyramids too. If you don&#8217;t want anyone to understand your chart, just move down lower in the list of available chart types. Excel does include some useful chart types, such as column, bar, line, and scatter charts. With <a href="http://peltiertech.com/Utility/" rel="nofollow" title="Peltier Tech Charting Add-Ins for Excel" >my charting utilities</a>, I have targeted some of the more intricate chart types that people would like to use but cannot find in Excel: waterfall charts, Marimekko charts, box plots, and now panel charts.</p>
<p>I recently released the <a href="http://peltiertech.com/Utility/PanelChartUtility.html" rel="nofollow" title="Peltier Tech Panel Chart Utility for Excel" >Peltier Tech Panel Chart Utility</a>, designed to draw the same type of panel dot plots as Naomi presented. Until now I&#8217;ve only shown sample panel utility charts using simple dummy data sets. In this post I&#8217;ll show how the program deals with real data.</p>
<p>So far the <a href="http://peltiertech.com/Utility/PanelChartUtility.html" rel="nofollow" title="Peltier Tech Panel Chart Utility for Excel" >panel chart utility</a> only generates dot plots; bar charts are still in development. Still, I thought this data was a good test for the utility.</p>
<p>Here is the first chart, using tasks as mini-chart categories and vendors as panel headers.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Dot Plot Trellis of BI Tasks by Vendor" src="http://peltiertech.com/images/2011-02/PanelGartner7_5x4_initial.png" alt="Dot Plot Panel of BI Vendors by Task" /></p>
<p>The chart looks okay except for the vertical axis labels. Excel likes to wrap them wherever it wants, not where you want, and the only recourse is to resize the chart or font, or use more concise labels. In fact, if you keep your labels short and sweet, the output of the utility needs no modification.</p>
<p>I replaced the labels with less verbose labels, and everything fit. I adjusted the scale maximum from 80 to 70. I was even able to shrink the chart a bit. I noticed that the panel headers were easier to read with a light pastel background, even if not bolded. While I was at it, I reformatted the data points. Attractive, legible, and meaningful, all in one graph.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Dot Plot Trellis of BI Tasks by Vendor" src="http://peltiertech.com/images/2011-02/PanelGartner7_5x4_finalorange.png" alt="Dot Plot Panel of BI Vendors by Task" /></p>
<p>I did the dot panel charts in this article using Excel 2007. Excel 2003 was a bit harder to reformat because it didn&#8217;t handle the labels as nicely. Or perhaps it was Excel 2007&#8242;s default font, Calibri, which is a bit smaller than Arial.</p>
<p>&lt;Excel2007 Rant&gt;I discovered that if I set my workbook default font to Arial (factory default is Calibri), the worksheets all use Arial, but the charts still use Calibri. I hate Calibri: the font is smaller, but the line heights are greater, which allows 2007 to squeeze fewer rows into the screen. Maybe Calibri worked in these charts with long labels, but in the future I&#8217;ll have to remember to change the font whenever I make a new chart.&lt;/Excel2007 Rant&gt;</p>
<p>Now I switched the two categorical variables, using vendor as mini-chart categories and task as panel header. The utility calculates that a 4 column x 2 row arrangement fits best.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Dot Plot Trellis of BI Tasks by Vendor" src="http://peltiertech.com/images/2011-02/PanelGartner7_4x2_initial.png" alt="Dot Plot Panel of BI Vendors by Task" /></p>
<p>Again, it doesn&#8217;t look too bad, except for those long-winded panel headers. I swapped them out for shorter labels, changed the scale maximum, made the chart a little wider and shorter, and applied some shades of blue. That&#8217;s a useful, readable chart.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Dot Plot Trellis of BI Tasks by Vendor" src="http://peltiertech.com/images/2011-02/PanelGartner7_4x2_finalblue.png" alt="Dot Plot Panel of BI Vendors by Task" /></p>
<p>The initial release of the panel chart utility computed an arrangement of rows and columns, and that was that. But overnight I made some modifications, and one feature I added was the option to overrule the computed arrangement. Rather than two rows of four, I tried three rows of three. The initial chart was excessively tall, so I reduced it to fit into this article.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Dot Plot Trellis of BI Tasks by Vendor" src="http://peltiertech.com/images/2011-02/PanelGartner7_3x3_initial_sm.png" alt="Dot Plot Panel of BI Vendors by Task" /></p>
<p>Again, those lengthy labels are causing problems. I shortened the labels, reduced the scale maximun, shrunk the height and increased the width of the chart, and used a green color scheme. Again, attractive and informative.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" title="Dot Plot Trellis of BI Tasks by Vendor" src="http://peltiertech.com/images/2011-02/PanelGartner7_3x3_finalgreen.png" alt="Dot Plot Panel of BI Vendors by Task" /></p>
<h2>A few notes about formatting panel charts made by the utility</h2>
<p>In order to deal with the internal workings of Excel 2007&#8242;s VBA interactions with a chart&#8217;s data labels, I had to use less efficient algorithms than I&#8217;d like. There is one data series per label, all instances of the same label are in one series, so you have to format the labels of each series. There is also one series per panel header label, so you have to go through all of them one by one; likewise the fill colors of the panel headers need to be modified one by one. All the labels along the top of the chart can be formatted en masse, as can all the labels along the bottom of the chart. I am testing algorithms which will make this less repetitive, but for now this is as good as it gets.</p>
<p><a href="http://peltiertech.com/WordPress/why-i-dont-like-excel-2007-charts/"title="Why I don't like Excel 2007 charts | Peltier Tech Blog" >I really hate to keep blaming Excel 2007</a>, but I feel it is justified. I didn&#8217;t need to go to these programming extremes in 2003, because labels with links were fast and reliable. Colleagues who deal with chart labels have concurred.
<p>Peltier Technical Services, Inc., Copyright © 2011.<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://peltiertech.com/Utility/" rel="nofollow"  title="PTS Chart Utilities: Waterfall, Cluster-Stack Column, Box and Whisker, Marimekko"><img src="http://peltiertech.com/Utility/pix/pts_banner_map.png" alt="PTS Chart Utilities: Waterfall, Box and Whisker, Cluster-Stack, Panel, Marimekko, Dot, Panel" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/trellis-plot-alternative-to-stacked-bar-chart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LOESS Utility &#8211; What the Buttons Mean</title>
		<link>http://peltiertech.com/WordPress/loess-utility-what-the-buttons-mean/</link>
		<comments>http://peltiertech.com/WordPress/loess-utility-what-the-buttons-mean/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 06:00:23 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=3054</guid>
		<description><![CDATA[Last fall in LOESS Utility – Awesome Update I introduced the latest version of my LOESS Utility for Excel. Compared to the earlier version, this one provides the user with much more flexibility in data range selection. As with all of my utilities, I made these adjustments after using the utility for my own real [...]]]></description>
			<content:encoded><![CDATA[<p>Last fall in <a href="http://peltiertech.com/WordPress/loess-utility-awesome-update/"title="LOESS Utility – Awesome Update" >LOESS Utility – Awesome Update</a> I introduced the latest version of my LOESS Utility for Excel. Compared to the earlier version, this one provides the user with much more flexibility in data range selection. As with all of my utilities, I made these adjustments after using the utility for my own real analysis. I don&#8217;t know of too many companies where the programmers are also users of the same software.</p>
<p>Lately I&#8217;ve received a few comments and emails asking how to use the utility&#8217;s dialog. I thought it was self-explanatory, but then, as the designer I already knew how it worked. This article is intended to answer these questions.</p>
<h2>The LOESS Utility Dialog</h2>
<p>The dialog has seven icon-buttons, and depending on which of these has been selected, one to four range selection boxes appear in the large empty space to the right of the buttons. The icons represent the data arrangement: Blue = X Input, Red = Y Input, Green = X Output, Orange = Y Output. The labels above the icons and the labels adjacent to the range selection boxes are intended to guide the user.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-02/loess_dialog_1a.png" alt="LOESS Utility Dialog" /></p>
<p><span id="more-3054"></span>The X Input and Y Input ranges must have the same number of rows, and the X Output and Y Output ranges also must have the same number of rows, but not necessarily the same number as the input ranges.Mismatched numbers of rows will result in an error, as will blank cells and non-numeric cells within the selected ranges (except that the contents of the Y Output range are ignored and overwritten).</p>
<p>If any two of the ranges selected in the range boxes are not contiguous, they need not begin on the same row.</p>
<p>One handy feature I built into this version of the utility is autoselection of the number of rows in a range. If you select the first data cell of a column, the utility determines how many rows are filled with data, and uses that range in its calculation. If you select more than one row, the program does no autoselection, but instead assumes you selected the rows you needed, and it calculates based on your selection. The autoselection means the user doesn&#8217;t have to count the number of rows of the ranges.</p>
<h2>LOESS Utility Button 1</h2>
<p>The first button needs only one range selection box, because the data all fits into a contiguous range. The first column of the range contains the X values (used for both X Input and X Output), the second column contains the Y Input data, and the Y Output data will be placed into the third column, overwriting any existing data in the column.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-02/loess_icon_1a.png" alt="LOESS Utility Dialog - Icon/Button 1" /></p>
<h2>LOESS Utility Button 2</h2>
<p>The second button needs two range selection boxes. The first column of the first range contains the X values (used for both X Input and X Output), the second column contains the Y Input data. The Y Output data will be placed into the only column of the second range, overwriting any existing data in the column. The Y Output range does not have to start on the same row as the first range. All ranges must have the same number of rows.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-02/loess_icon_2a.png" alt="LOESS Utility Dialog - Icon/Button 2" /></p>
<h2>LOESS Utility Button 3</h2>
<p>The third button needs three range selection boxes, each indicating a single column. The first range contains the X values (used for both X Input and X Output), the second rangecontains the Y Input data, and the Y Output data will be placed into the third range, overwriting any existing data in the column. The three ranges do not have to start on the same row. All ranges must have the same number of rows.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-02/loess_icon_3a.png" alt="LOESS Utility Dialog - Icon/Button 3" /></p>
<h2>LOESS Utility Button 4</h2>
<p>The fourth button needs two range selection boxes. The first range contains the X Input and Y Input data in the first and second columns of the range. The X output data is in the first column of the second range, and the Y Output data will be placed into the second column, overwriting any existing data in the column. The two ranges do not need to start on the same row or contain the same number of rows.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-02/loess_icon_4a.png" alt="LOESS Utility Dialog - Icon/Button 4" /></p>
<h2>LOESS Utility Button 5</h2>
<p>The fifth button needs three range selection boxes. The first range contains the X Input and Y Input data in the first and second columns of the range. The X output data is in the second range, and the Y Output data will be placed into the third range, overwriting any existing data in the column. The three ranges do not need to start on the same row. The second and third ranges must have the same number of rows, but not necessarily the same number of rows as the first range.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-02/loess_icon_5a.png" alt="LOESS Utility Dialog - Icon/Button 5" /></p>
<h2>LOESS Utility Button 6</h2>
<p>The sixth button needs three range selection boxes. The first range contains the X values, the second range contains the Y Input data, the first column of the third range contains the X Output values, and the Y Output data will be placed into the second column of the third range, overwriting any existing data in the column. The three ranges do not have to start on the same row. The first and second ranges must have the same number of rows, but not necessarily the same number of rows as the third range.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-02/loess_icon_6a.png" alt="LOESS Utility Dialog - Icon/Button 6" /></p>
<h2>LOESS Utility Button 7</h2>
<p>The seventh button needs all four range selection boxes. The first range contains the X Input values, the second range contains the Y Input data, the third range contains the X output values, and the Y Output data will be placed into the fourth range, overwriting any existing data in the column. None of the ranges have to start on the same row. The first and second ranges must have the same number of rows, and the third and fourth ranges must have the same number of rows, but not necessarily the same number of rows as the first and second ranges.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://peltiertech.com/images/2010-02/loess_icon_7a.png" alt="LOESS Utility Dialog - Icon/Button 7" /></p>
<h2>Smoothing Parameter and Number of Points</h2>
<p>The user can adjust the smoothness of the calculated Y Output by changing either the smoothing parameter alpha (the fraction of points used in the moving regression) or the number of points used in the moving regression. When one of these is changed, the other is updated, based on the number of points (rows) in the X Input range.</p>
<p>I think that values of 0.25 to 0.50 are typical for alpha, but it seems to me that if you have some logical number of points built into the data you should use that number. For example, if you have a few years of daily data, you might choose 90 points (3 months or a calendar quarter) for your analysis.</p>
<h2>Rerunning an Analysis</h2>
<p>When you perform a LOESS calculation with this utility, the values in the dialog are saved, and re-entered into the dialog the next time it is called on the same worksheet. Saved settings from one worksheet do not affect settings from another worksheet. If you use the output in a monthly report, this month&#8217;s settings are saved. Next month when you run the utility on the updated worksheet, your previous settings will be used as defaults, saving you a lot of time.</p>
<p>If you select only the first data cell of a range, the autoselection feature will select the right number of rows this month, and again next month even if data has been added or removed.</p>
<p>Peltier Technical Services, Inc., Copyright © 2011.<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://peltiertech.com/Utility/" rel="nofollow"  title="PTS Chart Utilities: Waterfall, Cluster-Stack Column, Box and Whisker, Marimekko"><img src="http://peltiertech.com/Utility/pix/pts_banner_map.png" alt="PTS Chart Utilities: Waterfall, Box and Whisker, Cluster-Stack, Panel, Marimekko, Dot, Panel" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/loess-utility-what-the-buttons-mean/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Label Last Point &#8211; Updated Add-In</title>
		<link>http://peltiertech.com/WordPress/label-last-point-updated-add-in/</link>
		<comments>http://peltiertech.com/WordPress/label-last-point-updated-add-in/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 05:00:12 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2606</guid>
		<description><![CDATA[On my web site I wrote a tutorial that showed how to Label the Last Point in an Excel Chart&#8217;s Series, and I posted a small add-in with the labeling procedure. I later blogged about this technique in Label Each Series in a Chart. When Excel 2007 came around, I discovered that the code no [...]]]></description>
			<content:encoded><![CDATA[<p>On my web site I wrote a tutorial that showed how to  <a href="http://peltiertech.com/Excel/Charts/LabelLastPoint.html" rel="nofollow" title="Label the Last Point in an Excel Chart's Series" >Label the Last Point in an Excel Chart&#8217;s Series</a>, and I posted a small add-in with the labeling procedure. I later blogged about this technique in <a href="http://peltiertech.com/WordPress/label-each-series-in-a-chart/"title="Label Each Series in a Chart | PTS Blog" >Label Each Series in a Chart</a>. When <a href="http://peltiertech.com/WordPress/category/excel-2007/"title="Excel 2007 Articles on the PTS Blog" >Excel 2007</a> came around, I discovered that the code no longer worked as expected because Excel 2007 treats unplottable points (blank cells or #N/A errors) differently than Excel 2003 had. I figured out a workaround and blogged about it in <a href="http://peltiertech.com/WordPress/label-last-point-for-excel-2007/"title="Label Last Point for Excel 2007 | PTS Blog" >Label Last Point for Excel 2007</a>. I never posted the corresponding add-in for Excel 2007.</p>
<p>The problem with the code in these pages is that they only labeled the active chart. The problem with this is that I often have a dozen or more charts to label, and it&#8217;s tedious to select and run the code, select and run the code, select and run the code, etc. So I recently made a minor adjustment to the code that would apply last point labels to the active chart, or to all selected charts. (You can select multiple charts by holding Shift or Ctrl while clicking on them.)</p>
<p><span id="more-2606"></span>It&#8217;s almost embarrassing how long it took me to enhance the code. The reason I didn&#8217;t is another &#8220;feature&#8221; of Excel 2007. In previous versions of Excel, when I wanted to carry out an action on the selected charts on a worksheet, I could check out the selected shapes, determine which shapes were chart objects, and act on each chart object.</p>
<pre class="vbasmall"><code>      Dim myChart As ChartObject
      Dim myShape As Shape

      ''' SELECTED SHAPES ON THE SHEET
      For Each myShape In Selection.ShapeRange
        ''' IS SHAPE A CHART?
        On Error Resume Next
        Set myChart = ActiveSheet.ChartObjects(myShape.Name)
        If Not Err Then
          ' check for surface chart (disallowed)
          If myChart.Chart.ChartType &lt; 83 Or myChart.Chart.ChartType &gt; 86 Then
            ''''''''''
            '' do what needs to be done
            ''''''''''
          End If
        End If
        On Error GoTo 0
      Next
</code></pre>
<p>For some reason, Excel 2007 was unable to detect which chart objects were selected, so it would process every chart object on the sheet. Not cool if you have painstakingly added a dummy series and applied custom data labels to the chart you had not selected.</p>
<p>I learned that you could add a shape to the sheet, and add this shape to the selection, and Excel 2007 would recognize which chart objects were actually selected. But this is a bit more contrived than I like. Not as elegant as my usual code (ha ha).</p>
<p>Leave it to my friend and colleague <a href="http://andypope.info/" rel="nofollow" title="Andy Pope's Excel Information" >Andy Pope</a> to find a workaround. Andy is great at looking at things a bit sideways and seeing what the rest of us have overlooked. Visit <a href="http://andypope.info/" rel="nofollow" title="Andy Pope's Excel Information" >Andy&#8217;s site</a> for a bunch of imaginative charting examples.</p>
<p>Anyway, Andy realized that the selection would consist of a set of objects, and you can test whether each object in the selection is a chart object. This approach works just fine in 2007 (and in 2003!).</p>
<pre class="vbasmall"><code>      Dim obj As Object

      '' check for error (i.e., selection isn't a bunch of shapes)
      On Error Resume Next
      For Each obj In Selection
        If TypeName(obj) = "ChartObject" Then
          ' check for surface chart (disallowed)
          If obj.Chart.ChartType &lt; 83 Or obj.Chart.ChartType &gt; 86 Then
            ''''''''''
            '' do what needs to be done
            ''''''''''
          End If
        End If
      Next
      On Error GoTo 0</code></pre>
<p>So finally I expanded my routine. I&#8217;ve packed it into an add-in, which works just fine in Excel 2003 and 2007. Download the zip file <a href="http://peltiertech.com/images/2009-11/PTSLabelLastPoint.zip" rel="nofollow" >PTSLabelLastPoint.zip</a> and unpack the add-in (PTSLabelLastPoint.xla). Install it using the applicable protocol in <a href="http://peltiertech.com/WordPress/installing-an-excel-add-in/"title="Installing an Excel Add-In in Excel 2003" >Installing an Excel Add-In</a> in Excel 2003 or in <a href="http://peltiertech.com/WordPress/installing-an-add-in-in-excel-2007/"title="Installing an Add-In in Excel 2007" >Installing an Add-In in Excel 2007</a>.</p>
<p>Peltier Technical Services, Inc., Copyright © 2011.<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://peltiertech.com/Utility/" rel="nofollow"  title="PTS Chart Utilities: Waterfall, Cluster-Stack Column, Box and Whisker, Marimekko"><img src="http://peltiertech.com/Utility/pix/pts_banner_map.png" alt="PTS Chart Utilities: Waterfall, Box and Whisker, Cluster-Stack, Panel, Marimekko, Dot, Panel" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/label-last-point-updated-add-in/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>LOESS Utility &#8211; Awesome Update</title>
		<link>http://peltiertech.com/WordPress/loess-utility-awesome-update/</link>
		<comments>http://peltiertech.com/WordPress/loess-utility-awesome-update/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 05:00:04 +0000</pubDate>
		<dc:creator>Jon Peltier</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[LOESS]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=2481</guid>
		<description><![CDATA[I talked about LOESS smoothing in LOESS Smoothing in Excel, where I showed my improved VBA function for calculating smoothed data. I introduced an improved LOESS Smoothing utility in LOESS Utility for Excel. Since I use the utility frequently, I encountered many things about it that I wanted to change. Since I am the developer [...]]]></description>
			<content:encoded><![CDATA[<p>I talked about LOESS smoothing in <a href="http://peltiertech.com/WordPress/loess-smoothing-in-excel/"title="LOESS Smoothing in Excel" >LOESS Smoothing in Excel</a>, where I showed my improved VBA function for calculating smoothed data. I introduced an improved LOESS Smoothing utility in <a href="http://peltiertech.com/WordPress/loess-utility-for-excel/"title="LOESS Utility for Excel" >LOESS Utility for Excel</a>. Since I use the utility frequently, I encountered many things about it that I wanted to change. Since I am the developer of the utility, I have actually been able to make these changes. And after a few months of use and a few hour-long sessions aimed at making it do what I want it to do, I&#8217;ve developed this utility into something that is, in the local vernacular, &#8220;wicked awesome&#8221;. If you&#8217;ve never seen &#8220;Good Will Hunting&#8221;, that means &#8220;way cool&#8221;.</p>
<p>What makes this utility so great, you ask? The calculations were already perfectly adequate, and I didn&#8217;t change them at all. But I&#8217;ll show the new dialog, so you can see what has changed.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/2009-10/loess_dialog_1.png" alt="New and Improved LOESS Utility Dialog" /></p>
<p><span id="more-2481"></span>First, the previous interface for selecting input and output ranges was frustratingly restrictive. So I made the range selection function much more flexible. The colorful buttons on the left indicate the built-in options. In the most elementary case, all four entries (X input, Y input, X output, and Y output) are separate ranges, which can even be located on separate worksheets.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/2009-10/loess_dialog_2.png" alt="New and Improved LOESS Utility Dialog" /></p>
<p>The options make range selection easier if some columns happen to be adjacent to each other, or if the same X values are to be used for both input and output. The range selection (Ref Edit) boxes and related labels update according to which option has been selected.</p>
<p>When the X input range has been selected, the program determines Npts, the number of points that should be used for the selected value of alpha. When the user changes alpha or Npts, the other parameter updates.</p>
<p>In the following case, one column serves as X input and X output (A7:A135), the adjacent column holds the Y input data (B7:B135), and the program will dump the Y output into a separate column (D7:D135).</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/2009-10/loess_dialog_3.png" alt="New and Improved LOESS Utility Dialog" /></p>
<p>Even this wasn&#8217;t smooth enough for me, because I got tired of scrolling up and down to select long ranges. So I made another improvement. I made the program smart enough to know that if only one row had been selected, it should use the range of data below the selected row, stopping at the first empty cell.<br class="spacer_" /></p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/2009-10/loess_dialog_4.png" alt="New and Improved LOESS Utility Dialog" /></p>
<p>Couldn&#8217;t be easier.</p>
<p>The last change I made was to have the utility store the last LOESS parameters in each worksheet. This way, if I run a particular analysis on each sheet in a workbook, I only have to activate that sheet, run the program, and the dialog is pre-populated with the settings I need. What a time-saver!</p>
<p><strong>PTS LOESS Utility Demo</strong></p>
<p>Here is a demo of the new utility. This analysis only took a few minutes. I started with some <a href="http://data.giss.nasa.gov/gistemp/graphs/Fig.A2.txt" rel="nofollow" title="Global Temperature Anomaly data from NASA" >Global Temperature Anomaly data from NASA</a>.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/2009-10/loess_temp_data.png" alt="Measured and LOESS-Smoothed Temperature Anomaly Data" /></p>
<p>I ran the utility to generate a smoothed temperature anomaly curve.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/2009-10/loess_temp_plot_1.png" alt="Measured and LOESS-Smoothed Temperature Anomaly Data" /></p>
<p>Then ran the utility a few more times to see the effect of alpha (number of points in the moving linear regression) on the shape of the smoothed curve. The values of 42, 25, and 12 points correspond to alpha values of 0.33, 0.2, and 0.1.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="/images/2009-10/loess_temp_plot_2.png" alt="Measured and LOESS-Smoothed Temperature Anomaly Data" /></p>
<p>The fewer points (i.e., smaller alpha) in an analysis, the more that the smoothed curve follows local variations in the data.</p>
<p><strong>Download and Install the Utility</strong></p>
<p>Click this <a href="/images/2009-10/PTS_LOESS.xla" rel="nofollow" title="PTS LOESS Smoothing Utility" >PTS LOESS Smoothing Utility</a> link to download the utility. The download is a simple Excel add-in. Save it to any convenient directory, then install it following the instructions in <a href="http://peltiertech.com/WordPress/installing-an-excel-add-in/">Installing an Excel Add-In</a> or <a href="http://peltiertech.com/WordPress/installing-an-add-in-in-excel-2007/">Installing an Add-In in Excel 2007</a>.</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 © 2011.<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://peltiertech.com/Utility/" rel="nofollow"  title="PTS Chart Utilities: Waterfall, Cluster-Stack Column, Box and Whisker, Marimekko"><img src="http://peltiertech.com/Utility/pix/pts_banner_map.png" alt="PTS Chart Utilities: Waterfall, Box and Whisker, Cluster-Stack, Panel, Marimekko, Dot, Panel" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://peltiertech.com/WordPress/loess-utility-awesome-update/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
	</channel>
</rss>

