Creating A Thermometer Style Chart

Category: Charts & Graphics | [Item URL]

Most people are familiar with "thermometer"-style graphs, which show the percentage of a project completed. It's easy to make such a display in Excel. The key is to create a chart that uses a single cell (containing a percentage value) as a data series.

The example below tracks daily progress toward a goal: 1000 new customers in a 15-day period.

Cell B18 contains the goal value. Cell B19 contains a simple sum formula:

=SUM(B2:B16)

Cell B21 contains the following formula, which calculates the percentage of the goal attained

 =B19/B18

As new data is entered in column B, the formulas display the current results.

To create the chart:

  1. Enter the formulas listed above, along with the worksheet's sample data.

  2. Select cell B21, and click the Chart Wizard button. Notice the blank row preceding cell B21. If you fail to include this blank row, Excel will use the entire data block--not just the single cell--to construct the chart. Since B21 is isolated from the other data, the Chart Wizard uses only the single cell.

  3. In step 1 of the Chart Wizard dialog, specify a Column chart and a Clustered Column subtype (the first choice).

  4. Click Next twice, and then in step 2 make additional adjustments: Add a Chart Title (Title tab), dump the Category (x) axis (Axes tab), delete the legend (Legend tab), and specify Show value (Data Labels tab). Click Finish to view the chart.

  5. Double-click the column to display the Format Data Series dialog box.

  6. Click the Options tab, and set the Gap width to 0 (this setting instructs the column to occupy the entire width of the plot area).

  7. To change the pattern used in the column, click the Patterns tab and make your selection. The example shown here uses a gradient fill effect.

  8. Double-click the vertical axis to bring up the Format Axis dialog. In the Scale tab of the Format Axis dialog, set Minimum to 0 and Maximum to 1.



Handle Missing Data In A Line Chart

Category: Charts & Graphics | [Item URL]

When you create a line chart in Excel, missing data points (blank cells) won't be plotted, and the line will contain gaps. Excel provides two other ways of handling missing data:

  • Treat blanks as zeros

  • Interpolate the data by connecting the line between the nonmissing data points.

The figure below shows both options. In this example, interpolating the missing data seems the better choice in view of the data's time-based nature.

To set how Excel deals with missing data, select your chart and choose Tools, Options. In the Options dialog box, click the Chart tab and then select the appropriate option. Your choice will apply to all data series in the selected chart.

You can also represent data with the formula =NA() instead of leaving a cell blank. The chart will use interpolation for data cells that contain this formula, regardless of the setting in the Options dialog box.



Format Cells To Display In Thousands

Category: Charts & Graphics | [Item URL]

In some cases, you may want to display thousands without zeros. For example, you would like 52,000 to appear as 52. Here's how to do it:

First, select the cells to be formatted, then choose Format, Cells. Click the Number tab. Select Custom from the Category list, and in the Type box enter 0, (that's a zero followed by a comma).

When this number format is applied, the cells will retain the correct numerical values, but they will be displayed without the last three digits.

To display values in millions, insert an additional comma at the end of the format string (0,,).

Another possibility is to display one or more decimal places--for example, 52,100 as 52.1. To do this, include a decimal point in your format string (0.0,).

You can also use these number formats in charts. To do so, double-click the chart axis to display the Format Axis dialog box. Then click the Number tab and specify the desired format. In Excel 2000 and later, the Scale tab of the Format Axis dialog box lets you specify the unit scaling directly. Just choose Millions from the "Display units" drop-down box.


Unlink A Chart Series From Its Data Range

Category: Charts & Graphics | [Item URL]

Normally, an Excel chart stores data in a range. If you change the data in that range, the chart updates automatically. Sometimes you may want to unlink the chart from its data ranges and produce a static chart that remains unaffected by later changes in the data. For example, suppose you plot data generated by various what-if scenarios, and you want to save a chart that represents some baseline scenario for comparison with others.

One way to create a static chart is to copy and paste it as a picture. Activate your chart, hold down the Shift key, and choose Edit, Copy Picture (this option is available only when you hold down Shift as you select Edit). The Copy Picture dialog box will appear. Click OK to accept the defaults. Then click anywhere in your worksheet and choose Edit, Paste.

Another way to create a static chart is to convert the range references into arrays. Select a chart series and then click the formula bar to activate the SERIES() formula. Press F9 to convert the range references into arrays. Repeat this for each series in the chart. Now the chart cans till be formatted (it doesn't become a picture). The formula bar in the figure below shows the SERIES() formula after converting the range references to arrays.



Saving A Chart As A GIF FIle

Category: Charts & Graphics | [Item URL]

If you would like to convert an Excel chart to a GIF file, you can save your worksheet as an HTML file, and Excel will automatically convert any charts to GIF files. If that seems like overkill, you can write a simple macro that will do the job.

Press Alt-F11 to activate the Visual Basic editor. Select your workbook in the Projects window, and choose Insert, Module to insert a new VBA module. Then type the following four-line procedure into the module:

Sub SaveChartAsGIF ()
    Fname = ThisWorkbook.Path & "\" & ActiveChart.Name & ".gif"
    ActiveChart.Export FileName:=Fname, FilterName:="GIF"
End Sub

After the macro is entered, reactivate Excel and click the chart to be saved. Press Alt-F8 to display the Macro dialog box. Select the SaveChartAsGIF macro and click Run.

The procedure uses the chart's name as the GIF file name, and the file is stored in the same directory as the workbook. This simple macro does no error checking, so it will generate an error if a chart is not selected or if the workbook has not been saved.



Animated Hypocycloid Charts

Category: Charts & Graphics / General VBA | [Item URL]

A companion file is available: Click here to download

With a few simple macros, you can creating some interesting animation effects in charts. For example, I created a workbook that displays an infinite number of dazzling animated charts. The workbook is set up with a simple user interface that makes it very easy to generate a new chart or save the parameters for charts that you like. Turn animation on or off with the click of a button.

The chart displays what's known as a hypocycloid curve -- the path formed by a point on a circle that rolls inside of another circle. This, as you may recall from your childhood, is the same technique used in Hasbro's popular Spirograph toy.

The workbook is not protected, so you can view the formulas and VBA macros that are used.

hypo1.gif (7866 bytes)
 



Page 2 of 2 pages
[Previous page]  

Search for Tips


All Tips

Browse Tips by Category

Tip Books

Needs tips? Here are two books, with nothing but tips:

Contains more than 200 useful tips and tricks for Excel 2007 | Other Excel 2007 books | Amazon link: John Walkenbach's Favorite Excel 2007 Tips & Tricks

Contains more than 100 useful tips and tricks for Excel 2013 | Other Excel 2013 books | Amazon link: 101 Excel 2013 Tips, Tricks & Timesavers

© Copyright 2017, J-Walk & Associates, Inc.
Privacy Policy