Sub topic 6
Building a Bar Chart
This chapter assumes you can select ranges, use the Insert tab, and read the series and categories layout from earlier chapters. A bar chart uses the same data and the same steps as a column chart. The bars run horizontally instead of vertically.
When a bar chart is the better choice
Use a bar chart when category names are long. Horizontal bars give each label its own line, so the text stays readable and does not rotate or wrap. Bar charts also suit rankings, because a sorted list reads naturally from top to bottom.
Build one from a range
Use the sample range from the column chart chapter, with a header row, one category column, and one value column:
Region Sales
North 120
South 95
East 140
West 80- Select the whole range, including the header row (A1:B5).
- Go to Insert, open the Insert Column or Bar Chart menu, and choose Clustered Bar under 2-D Bar.
- Excel places the chart on the sheet. The header "Sales" becomes the series name, and the regions become the categories.
The VBA macro from the column chart chapter produces a bar chart if you change one line:
Sub CreateBarChart()
Dim co As ChartObject
Set co = ActiveSheet.ChartObjects.Add(Left:=100, Top:=50, Width:=400, Height:=250)
With co.Chart
.SetSourceData Source:=ActiveSheet.Range("A1:B5")
.ChartType = xlBarClustered
.HasTitle = True
.ChartTitle.Text = "Sales by Region"
End With
End SubThe order problem
The first thing most people notice is that the categories appear upside down. North is at the bottom and West is at the top. Excel draws the first category nearest the axis origin, and on a bar chart that origin is at the bottom.
To fix it:
- Right-click the vertical (category) axis and choose Format Axis.
- Under Axis Options, check Categories in reverse order.
Reversing the order moves the value axis to the top of the chart. If you want it at the bottom, set Horizontal axis crosses to At maximum category in the same pane.
How the order flows
Common mistakes
- Using a bar chart for time. Dates and months suggest a left-to-right flow. Use a column or line chart for those.
- Leaving the sort order alone. Unsorted bars make comparison harder. Sort the data before you chart it.
- Long data labels that overlap the bars. Widen the chart or move labels to Outside End.
Exercise
Your bar chart shows North at the bottom and West at the top, but your table lists North first. Which setting makes the chart match the table, and where does the value axis move as a result?
Show answer
Open Format Axis on the vertical category axis and check "Categories in reverse order". The value axis moves to the top of the chart. Set "Horizontal axis crosses" to "At maximum category" to bring it back to the bottom.