Sub topic 4
Showing magnitude with data bars
This chapter assumes you can select ranges, apply basic cell formatting, and have used at least one built-in rule from the Home tab. Data bars draw a horizontal bar inside each cell. The bar's length reflects the cell's value compared with the other values in the range, so you can compare magnitudes at a glance without reading every number.
Applying a data bar
- Select the numeric cells, for example
C2:C21. - On the Home tab, choose Conditional Formatting, then Data Bars.
- Pick a Gradient Fill or Solid Fill style in the color you want.
Solid fills are easier to compare, because a gradient fades toward the right edge of the bar and makes the true length harder to judge.
Excel scales the bars automatically. By default, the shortest bar belongs to the lowest value in the range and the longest bar belongs to the highest. A cell with a value in the middle gets a bar of about half the full width.
How bar length is calculated
Each rule has a minimum and a maximum that anchor the scale. The default type for both is Automatic, which means Excel picks the scale from the data. You can change this to make the bars more honest or more useful.
| Type | What it does | Typical use |
|---|---|---|
| Lowest Value / Highest Value | Uses the smallest and largest value in the range | Default look for most data |
| Number | Uses a fixed number you type | Compare against a known scale, such as 0 to 100 |
| Percent | Uses a percentile of the range | Ignore a few extreme values |
| Formula | Uses the result of a formula | Scale against a value stored in another cell |
To change these settings, open Conditional Formatting, choose Manage Rules, select the data bar rule, and click Edit Rule.
Setting a fair scale
With the Automatic setting, Excel may start the scale above zero. In a column of values between 950 and 1000, a value of 950 would show almost no bar, and 1000 would show a full bar. The difference looks huge, though it is only about 5 percent.
To avoid this, set the minimum type to Number and the value to 0. Then bar length is proportional to the real value.
For a percentage column, set Minimum to Number 0 and Maximum to Number 1 (that is, 100%). Every bar then shows progress toward 100% instead of being scaled to whatever the data happens to contain.
Useful options
The Edit Rule dialog has several other settings.
- Show Bar Only hides the number and leaves only the bar. This works well for dashboards, but readers lose the exact value.
- Fill switches between solid and gradient.
- Border adds an outline to each bar.
- Negative Value and Axis lets negative numbers have a different bar color and direction. Negative bars extend left from an axis, and positive bars extend right.
- Bar Direction can be set to left-to-right, right-to-left, or context-based.
Data bars in the flow of a worksheet
The diagram below shows how Excel turns a value into a bar.
Common problems
- All bars look the same length. The values are close together and the scale starts near them. Set the minimum to Number 0.
- One huge bar and many tiny ones. An outlier is stretching the scale. Set the maximum type to Percent, such as 90, or to a Number you choose.
- No bars appear. Check that the cells hold real numbers and not text that looks like numbers. Numbers stored as text are left-aligned by default and have no bar.
- Bars overlap the numbers. Widen the column or use Show Bar Only.
Exercises
Exercise
A column holds scores from 90 to 100, and the data bars make a score of 90 look almost empty. What change in Edit Rule gives bars that reflect the true proportions?
Show answer
Set the Minimum type to Number with the value 0. Bar length is then proportional to the actual value instead of starting near the lowest score.
Exercise
A range contains one value of 50,000 while all other values are between 100 and 400, so most bars are tiny. Name one setting that fixes this.
Show answer
Change the Maximum type from Automatic to Percent (for example 90) or to a fixed Number such as 400. This stops the outlier from stretching the scale.