Adding a second X axis to an Excel chart lets you plot two data series that use different horizontal scales on the same graph. This is useful when you have, for example, temperature readings over time and rainfall over a different time period, or price points against a numeric range. Excel does not have a direct "add secondary X axis" button, but you can achieve it by combining a secondary vertical axis with a hidden series and adjusting the axis labels. Here is the step-by-step process that works in Excel 2016, 2019, 365, and most other recent versions.
What You'll Need
- A computer with Microsoft Excel (Windows or Mac). The steps are nearly identical on both, but menu names may differ slightly.
- A worksheet with at least two data series that you want to plot on different X scales. For example, one series with X values 1-10 and another with X values 100-1000.
- Basic familiarity with selecting data and inserting charts. If you can insert a standard line or scatter chart, you are ready.
Step-by-Step
These steps assume you have two data sets: one for the primary X axis (say, time in days) and one for the secondary X axis (say, a different time range or a numeric scale). You will create a chart that uses a secondary vertical axis as a placeholder, then convert that axis into a second horizontal axis.
- Prepare your data. Put both data series in the same worksheet. For clarity, place the primary X values in column A, the primary Y values in column B, the secondary X values in column C, and the secondary Y values in column D. Example: A1:A10 = 1,2,3...10; B1:B10 = your primary Y; C1:C10 = 100,200,300...1000; D1:D10 = your secondary Y.
- Insert a chart with the primary series. Select the primary X and Y data (columns A and B) and go to the Insert tab. Choose a Scatter chart (with straight lines or markers) or a line chart. Scatter is usually best because it treats X as a true numeric axis.
- Add the secondary series to the chart. Right-click on the chart and select Select Data. Click Add to create a new series. For the series name, enter a label. For the X values, select the secondary X range (column C). For the Y values, select the secondary Y range (column D). Click OK. You now have two series on the same chart, but both use the same X axis.
- Move the secondary series to a secondary vertical axis. Right-click on the data points of the secondary series (the one you just added) and choose Format Data Series. In the panel that opens, look for Series Options and select Secondary Axis. This will add a secondary vertical axis on the right side of the chart. The secondary series will now plot against that axis.
- Create a hidden series to force the secondary X axis. This is the key step. You need to add a third series that will act as a placeholder. Right-click the chart, choose Select Data, and click Add. For this series, use the secondary X values (column C) as both the X and Y values. In other words, set both the X and Y ranges to column C. This series will plot a diagonal line of points.
- Format the hidden series to be invisible. Right-click on the points of this new series (you may need to click on the chart and use the legend to select it) and choose Format Data Series. Set the Line to No line and the Marker to None. This hides the series visually.
- Assign the hidden series to the secondary vertical axis. Still in Format Data Series, under Series Options, select Secondary Axis again. This places the hidden series on the same secondary vertical axis as your actual secondary data.
- Add a secondary horizontal axis. Now, with the secondary vertical axis selected (you can click on the numbers on the right side of the chart), go to the Chart Design tab (or Format tab) and click Add Chart Element > Axes > Secondary Horizontal. This will add a new horizontal axis at the top of the chart. Because you have a series (the hidden one) that uses the secondary vertical axis and has X values from column C, Excel will use those values for the secondary horizontal axis.
- Adjust the secondary horizontal axis scale. Right-click on the new top horizontal axis and choose Format Axis. Set the minimum and maximum bounds to match the range of your secondary X data (e.g., 100 to 1000). Also set the major unit if needed. This ensures the axis displays the correct scale.
- Clean up the chart. You may want to remove the secondary vertical axis (the one on the right) if you don't need it, or keep it if you have a secondary Y scale. To remove it, right-click on it and select Delete. However, if you delete it, the secondary horizontal axis may disappear as well. In that case, you can keep it and format it to have no labels or no line, or you can hide it by setting the font color to white. Alternatively, you can leave it as is if it adds useful information.
- Format the secondary horizontal axis labels. If you want the top axis to have different labels than the bottom, you can customize them by right-clicking the axis and selecting Format Axis > Axis Options > Number to change the format, or you can use the Labels section to set the label position to High or Low.
Common Mistakes
- Forgetting to add the hidden series. Without it, the secondary horizontal axis will not appear or will not align with your data.
- Using a line chart instead of a scatter chart. Line charts treat X as categories, not as numeric values. For a true dual X axis with numeric scales, use a scatter chart. If you use a line chart, the secondary axis will show category numbers rather than the actual X values.
- Not setting the secondary axis bounds manually. Excel may auto-scale the secondary horizontal axis to fit the hidden series, which might not match your desired range. Always set the minimum and maximum to your data range.
- Deleting the secondary vertical axis. If you delete the secondary vertical axis, the secondary horizontal axis may vanish because they are linked. If you don't want the right-side axis, format it to have no labels and no line instead of deleting it.
- Selecting the wrong series when formatting. When you right-click to format a series, make sure you have selected the correct one. Use the legend or the Format tab's Current Selection dropdown to pick the exact series.
Tips
- Use a secondary vertical axis only if needed. If your secondary Y values are on the same scale as the primary, you can skip the secondary vertical axis and just use the secondary horizontal axis. However, the method above is the most reliable for getting a second X axis.
- Name your series clearly. In the Select Data dialog, give each series a descriptive name. This makes it easier to identify them when formatting.
- Test with a small dataset first. If you are new to this, try with a few rows of data to understand the steps before applying them to a large dataset.
- Use a chart template. Once you have the dual X axis chart set up, you can save it as a template (right-click the chart > Save as Template) and reuse it for future charts.
- Consider a combination chart. If you only need two different X scales, sometimes a combo chart (e.g., column + line) with a secondary axis can work, but it still requires the hidden series trick for a true second X axis.
Troubleshooting
If the secondary horizontal axis does not appear after following the steps, check the following:
- Is the hidden series actually on the secondary vertical axis? If it is still on the primary axis, the secondary horizontal axis will not use its X values. Right-click the hidden series and confirm that Secondary Axis is selected.
- Did you add the secondary horizontal axis? Go to Chart Design > Add Chart Element > Axes and ensure Secondary Horizontal is checked.
- Are the X and Y ranges for the hidden series correct? The hidden series must use the secondary X values for both X and Y. If you accidentally used the primary X values, the axis will be wrong.
- Is the chart type scatter? If you used a line chart, the X axis is categorical. Switch to a scatter chart by right-clicking the chart and selecting Change Chart Type.
- Does the secondary axis show but with wrong numbers? Right-click the secondary horizontal axis and set the bounds manually to your data range.
- If all else fails, restart Excel. Occasionally, the chart engine gets confused. Close and reopen the workbook, or create a new chart from scratch.
Frequently Asked Questions
Can I have two X axes without a secondary Y axis?
Yes, but the method is the same. You can hide the secondary vertical axis by setting its labels to None and its line to No line in the Format Axis panel. The secondary horizontal axis will still work.
Why does my secondary X axis show numbers like 1, 2, 3 instead of my data?
This usually happens when you use a line chart instead of a scatter chart. Line charts treat X values as categories, so they ignore the actual numbers. Switch to a scatter chart.
Can I use a dual X axis with a bar chart?
Bar charts are not designed for numeric X axes. You would need to use a scatter chart or a line chart. If you need bars, consider using a column chart with a secondary axis, but that only gives a secondary Y axis, not a second X axis.
How do I change the position of the secondary X axis (e.g., put it on the bottom)?
By default, the secondary horizontal axis appears at the top. To move it to the bottom, right-click the axis and select Format Axis. Under Axis Options, look for Horizontal axis crosses and set it to Automatic or Axis value and enter a value that places it at the bottom. However, this may conflict with the primary axis. It is usually best to keep it at the top for clarity.
Can I have more than two X axes?
Excel only supports a primary and a secondary axis. To have more than two, you would need to create separate charts and overlay them, which is complex and not recommended.
Does this work in Excel for Mac?
Yes, the steps are the same, but the menu names may differ slightly. For example, Format Data Series might be under the Format tab. The Add Chart Element button is also available on the Mac version.