Analyzing Cell Values with Data Bars in Excel 2007

Microsoft Excel, Tips & Tricks Add comments

msexceltweak.pngData analysis is often more about the relationships between values in a range than it is about the values themselves. For example, in a table of sales where one product sells 600 units and another sells 300, you might be interested only in the fact that the former sold twice as much as the latter, regardless of the actual sales. Excel 2007 comes with a new tool that enables you to quickly and easily perform these kinds of relative analyses: data bars. Data bars are colored, horizontal bars that display “behind” the values in a range. Their key feature is that the length of the data bar that displays in each cell depends on the value in that cell: the larger the value, the longer the data bar. The cell with the highest value has the longest data bar, and the data bars that display in the other cells have lengths that reflect their values. (For example, a cell with a value that is half of the largest value has a data bar that’s half as long as the longest data bar.)

To apply data bars to the selected range, choose Home, Conditional Formatting, Data Bars, and then choose the color you prefer. Figure 1 shows a worksheet of product sales, with data bars applied to the values in the Units column.

Excel configures its default data bars with the longest data bar based on the highest value in the range and the shortest data bar based on the lowest value in the range. However, what if you want to visualize your values based on different criteria? With test scores, for example, you might prefer to see the data bars based on values between 0 and 100 (so for a value of 50, the data bar always fills only half the cell, no matter what the top mark is).

A worksheet with Excel 2007's new data bars applied to the Units column
Figure 1 A worksheet with Excel 2007’s new data bars applied to the Units column.

To apply custom data bars, select the range and then choose Home, Conditional Formatting, Data Bars, More Rules to display the New Formatting Rule dialog box. In the Edit the Rule Description group, make sure Data Bar displays in the Format Style list. Notice that there is a Type list for both the Shortest Bar and Longest Bar. The type deter­mines how Excel applies the data bars. You have five choices:

Lowest/Highest Value

This is the default data bar type: The lowest value in the range gets the shortest data bar, and the highest value in the range gets the longest data bar.

Number

Use this type to base the data bar lengths on values that you specify in the two Value text boxes. For the Shortest Bar, any cell in the range that has a value less than or equal to the value you specify will get the shortest data bar; similarly, for the Longest Bar, any cell in the range that has a value greater than or equal to the value you specify will get the longest data bar.

Percent

Use this type to base the data bar lengths on a percentage of the largest value in the range. For the Shortest Bar, any cell in the range that has a relative value less than or equal to the percentage you specify will get the shortest data bar; for example, if you specify 10 percent and the largest value in the range is 1,000, then any cell with a value of 100 or less will get the shortest data bar. For the Longest Bar, any cell in the range that has a relative value greater than or equal to the percentage you specify will get the longest data bar; for example, if you specify 90 percent and the largest value in the range is 1,000, then any cell with a value of 900 or more will get the longest data bar.

Formula

Use this type to base the data bar lengths on a formula.

Percentile

Use this type to base the data bar lengths on the percentile within which each cell value falls given the overall range of the values. In this case, Excel ranks all the values in the range and assigns each cell a position within the ranking. For the Shortest Bar, any cell in the range that has a rank less than or equal to the percentile you specify will get the shortest data bar; for example, if you have 100 values and specify the 10th percentile, the cells ranked 10th or less will get the shortest data bar. For the Longest Bar, any cell in the range that has a rank greater than or equal to the percentile you specify will get the longest data bar; for example, if you have 100 values and specify the 75th percentile, then any cell ranked 75th or higher will get the longest data bar.

One thing you can’t do directly with data bars is apply multiple colors. This is a handy way to, say, display particularly low values in red or particularly high values in green. You can apply different colored data bars multiple times to a given range, but Excel always displays only the most recent data bars.

You can work around this problem by manipulating some range properties via VBA. Each Range object has an associated FormatConditions collection, which holds all the conditional formatting rules that have been applied to the range. If you’ve applied two rules to the range, for example, then the first one you applied is FormatConditions(1) and the second is FormatConditions(2). Each of these returns a FormatCondition object, which in turn has a Formula property.

Technorati Tags: ,

Popularity: 3% [?]

Related Post

  • Allowing Only Certain Values in a Cell
  • Applying Percentile-Based Icon Sets in Excel 2007
  • Using a Watch Window to Watch a Cell Value in Excel 2007
  • Calculating Multiple Solutions to a Formula in Excel 2007
  • Animating Chart Elements in PowerPoint 2007
  • Don't Find What You're Looking For? Please Try Here...

    Google
     

    Leave a Reply

    WP Theme & Icons by N.Design Studio
    Entries RSS Comments RSS Add to Technorati Favorites Log in