Sub topic 13
Combining Column and Line Series with a Secondary Axis
This chapter assumes you can insert a column chart and a line chart from a selected range, and that you know what a series and a category are. If not, review the earlier chapters on series and categories and on building column and line charts.
Why combine two chart types
A combination chart (combo chart) draws different series in different chart types on the same plot area. A common case is columns for a quantity and a line for a rate or running total. The two series share the same categories, such as months, so the reader can compare them at each point.
The problem appears when the series have very different scales. Suppose sales are in the hundreds and profit margin is between 0.10 and 0.30. On one axis, the margin line sits flat along the bottom and shows nothing. A secondary axis fixes this. It is a second value axis, drawn on the right side, that scales only the series assigned to it.
Sample data
Put this in A1:C5. Sales is in units and Margin is a fraction. Format C2:C5 as a percentage.
Region Sales Margin
North 120 0.22
South 95 0.18
East 140 0.27
West 80 0.15Build the combo chart in the ribbon
- Select A1:C5.
- On the Insert tab, open Insert Combo Chart in the Charts group.
- Choose Create Custom Combo Chart.
- For the Sales series, set the chart type to Clustered Column.
- For the Margin series, set the chart type to Line with Markers.
- Tick Secondary Axis beside Margin, then click OK.
Excel now shows the Sales scale on the left and the Margin scale on the right. Both series still use the same category axis.
Change an existing chart instead
You can also start from a normal column chart. Click one series, right-click it, and choose Change Series Chart Type. Pick a line type for that series and tick Secondary Axis. This is useful when the chart already has formatting you want to keep.
Common errors
- The line is flat or hidden. The series is still on the primary axis. Open Change Series Chart Type and tick Secondary Axis for that series.
- The right axis has no label. Excel adds two value axes but does not name either. Select the chart, use Chart Elements (the plus button), and add axis titles, for example "Sales (units)" and "Margin (%)".
- Readers match the wrong scale. Two axes invite misreading. Color the axis titles to match their series, and use a secondary axis only when the scales truly differ.
- Both axes start at different zero points. Check each axis under Format Axis and set the minimum deliberately, so the columns do not look taller than the data supports.
Do it with VBA
This macro builds the same chart. It assumes the data above is in A1:C5 of the active sheet.
Sub CreateComboChart()
Dim co As ChartObject
Set co = ActiveSheet.ChartObjects.Add(Left:=100, Top:=50, Width:=420, Height:=260)
With co.Chart
.SetSourceData Source:=ActiveSheet.Range("A1:C5")
.ChartType = xlColumnClustered
With .SeriesCollection(2)
.ChartType = xlLineMarkers
.AxisGroup = xlSecondary
End With
.HasTitle = True
.ChartTitle.Text = "Sales and Margin by Region"
End With
End SubSetting AxisGroup = xlSecondary is the code equivalent of the Secondary Axis checkbox.
Exercise
A chart plots monthly revenue (values near 50,000) as columns and conversion rate (values near 0.04) as a line. The line looks flat along the bottom. What two changes in Change Series Chart Type fix it, and what should you add afterward so readers can interpret it?
Show answer
Set the conversion rate series to a line chart type and tick Secondary Axis for it. Then add axis titles for both value axes, such as "Revenue" and "Conversion rate (%)", so readers know which scale belongs to which series.