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. You should also know how to open the Select Data dialog. If any of that is unfamiliar, review the earlier chapters on series and categories and on building column and line charts first.
Why combine two chart types
A combination chart (also called a combo chart) plots different series in one chart area using different chart types. The most common pairing is columns for one measure and a line for another. Columns suit amounts that belong to a period, such as revenue per month. A line suits a value that moves continuously or is a rate, such as profit margin.
A combo chart answers a question that two separate charts answer badly: how do two related measures move together over the same categories? Putting them in one plot lets the reader compare timing, such as whether margin dips in the months when revenue peaks.
The scale problem
All series in a chart share one value axis by default. This works only when the series have similar magnitudes. Suppose revenue is in the thousands and margin is a percentage between 0.10 and 0.30. On a shared axis running from 0 to 6,000, the margin line sits flat along the bottom of the plot and shows no movement.
The fix is a secondary axis. This is a second vertical value axis, drawn on the right side of the chart, that has its own scale. A series assigned to it is scaled against the right axis. The category axis stays shared.
Sample data
Enter this range in A1:C7. Revenue is in dollars. Margin is stored as a decimal and formatted as a percentage.
Month Revenue Margin
Jan 4200 0.18
Feb 5100 0.22
Mar 4800 0.17
Apr 5900 0.25
May 6400 0.21
Jun 5700 0.28Select C2:C7 and apply the Percentage number format from the Home tab so that the margin values display as 18%, 22%, and so on. The stored values stay decimals.
Building the combo chart
There are two routes. The second is more direct for most people.
Route 1: change one series of an existing chart
- Select A1:C7 and insert a clustered column chart. Both series appear as columns. The Margin columns are nearly invisible.
- Right-click a Margin column and choose Change Series Chart Type. In older versions, choose Change Chart Type and then Combo.
- In the dialog, set Margin to Line (or Line with Markers).
- Tick the Secondary Axis box beside Margin.
- Click OK.
Route 2: the Combo chart type
- Select A1:C7.
- On the Insert tab, open the Combo chart gallery and choose Create Custom Combo Chart.
- For Revenue, choose Clustered Column. For Margin, choose Line with Markers.
- Tick Secondary Axis for Margin.
- Click OK.
The gallery also offers a ready-made "Clustered Column - Line on Secondary Axis" option. It makes the same choices in one click.
What the result contains
The chart now has these parts:
- A shared category axis along the bottom showing the months.
- A primary value axis on the left, scaled for Revenue.
- A secondary value axis on the right, scaled for Margin.
- A legend listing both series.
Excel picks the scale of each axis on its own. The right axis here will probably run from 0% to 30%.
Making the axes readable
A second axis creates a risk: readers must work out which axis belongs to which series. Reduce that risk with these steps.
- Title each axis. Select the chart, open the Chart Elements button (the plus sign), and tick Axis Titles. Click each title and type "Revenue ($)" and "Margin (%)". Excel adds only the primary titles in some versions, so check both sides.
- Match colors. Color the right axis labels and the line the same way. Select the secondary axis, open Format Axis, and set the text color under Text Options. Do the same for the left axis and the columns.
- Keep gridlines to one axis. Only primary gridlines are on by default. Leave it that way. Two sets of gridlines at different intervals do not line up and confuse the eye.
- Format the number display. Select the secondary axis, open Format Axis, and under Number set the category to Percentage with 0 decimal places. If the axis shows 0.3 instead of 30%, the source cells lack the percentage format or the axis is set to link to the wrong source.
Setting axis bounds deliberately
Excel chooses axis minimums and maximums automatically, and the two axes are chosen independently. This can create a misleading picture. A line may seem to cross the tops of the columns, which suggests a relationship that is only an accident of scaling.
To control this, select an axis, open Format Axis, and under Bounds set Minimum and Maximum yourself. For example, set the primary axis to 0 to 8,000 and the secondary axis to 0 to 0.4. Choose bounds so that the line floats clear of the columns where it can, or so that the major gridline count matches on both sides. Matching the count, such as 4 intervals on each axis, keeps the gridlines aligned with tick marks on both sides.
Two cautions apply:
- Keep the column axis starting at zero. Columns encode value by length, so a truncated base exaggerates differences.
- A line can use a non-zero minimum, because a line encodes value by position and slope.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| The line is flat at the bottom | The series is still on the primary axis | Change Series Chart Type, then tick Secondary Axis |
| No right-hand axis appears after ticking the box | The secondary axis is hidden in Chart Elements | Open Chart Elements, expand Axes, and tick Secondary Vertical |
| The line starts at the edge of the first column group, not at its center | The line is plotted "on tick marks" | Format the category axis and set Axis position to Between tick marks |
| Columns are hidden behind the line | The series order or chart type is wrong | Series on the secondary axis draw in front. Keep the line on the secondary axis and the columns on the primary |
| Margin shows as 0.2 | Source cells are not percent formatted | Apply Percentage format to C2:C7, or set it on the axis |
| A tooltip or label shows the wrong series | Series names were not read from the header row | Open Select Data and edit the series name to point to B1 or C1 |
Combining with the Select Data dialog
A combo chart is still a normal chart, so everything from earlier chapters applies. Open Select Data to add a third series, rename a series, or change its range. If you add a new series, it takes the chart type of the chart as a whole. Open Change Series Chart Type again to set its type and axis.
You can put more than one series on the secondary axis. They then share the right-hand scale, so only group series that have similar units.
Limits of the technique
- Avoid pairing a pie chart with another type. Excel does not allow a pie in a combination chart with columns or lines.
- A bar chart (horizontal) can be combined only awkwardly, because its category axis is vertical and a line series runs horizontally. For this pairing, use columns.
- Beyond two measures, a single chart gets crowded. Consider two charts, one above the other, that share the same category order.
Doing it with VBA
If you automate chart creation, the same structure applies. This macro builds the chart from A1:C7, converts Margin to a line, and moves it to the secondary axis.
Sub CreateComboChart()
Dim co As ChartObject
Set co = ActiveSheet.ChartObjects.Add(Left:=100, Top:=50, Width:=450, Height:=280)
With co.Chart
.SetSourceData Source:=ActiveSheet.Range("A1:C7")
.ChartType = xlColumnClustered
With .SeriesCollection(2)
.ChartType = xlLineMarkers
.AxisGroup = xlSecondary
End With
.HasTitle = True
.ChartTitle.Text = "Revenue and Margin by Month"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Text = "Revenue ($)"
.Axes(xlValue, xlSecondary).HasTitle = True
.Axes(xlValue, xlSecondary).AxisTitle.Text = "Margin (%)"
End With
End SubSetting AxisGroup = xlSecondary is what creates the right-hand axis. Set the series type first, then the axis group.
Summary of decisions
Use a combo chart when two measures share categories and differ in unit or magnitude. Put the larger-scale amount on columns and the rate or ratio on a line. Assign the line to the secondary axis, title both axes, match colors to series, and set bounds on purpose.
Exercise
A chart plots Units Sold (values from 800 to 1,200) as columns and Price (values from 9.50 to 11.00) as a line. The price line is flat along the bottom. Name the steps that fix it, and say whether the secondary axis for Price should start at zero.
Show answer
Right-click the Price series, choose Change Series Chart Type, set Price to Line, and tick Secondary Axis. Title both axes and color them to match their series. The Price axis does not need to start at zero, because a line encodes value by position, so a range such as 9 to 11.50 shows the movement. The Units Sold axis should start at zero, because columns encode value by length.
Exercise
You tick Secondary Axis for a series, but the right-hand axis does not show. Where do you turn it on?
Show answer
Select the chart, open Chart Elements (the plus sign), expand Axes, and tick Secondary Vertical. In VBA, set the series' AxisGroup to xlSecondary and make sure HasAxis(xlValue, xlSecondary) is True.