To change the x-axis labels on an Excel line chart, select the chart, choose Chart Design > Select Data, then under Horizontal (Category) Axis Labels choose Edit and select the cells you want to use. A line chart treats these as categories; if you need the x-axis to represent actual numeric values with proportional spacing, change the chart to an XY (Scatter) chart instead.
What x-axis values mean in a line chart
In a line chart, the horizontal axis is usually a category axis. Its entries identify the points in sequence, such as months, product names, or measurement labels. Excel places those categories in order, typically with equal spacing between adjacent entries. The labels may look like numbers or dates, but that does not necessarily mean Excel is using their numeric distance to position the points.
For example, a line chart with labels 1, 2, and 10 normally spaces all three categories evenly. It does not make the gap from 2 to 10 eight times wider than the gap from 1 to 2. This behavior is useful for evenly spaced reporting periods or named categories, but it can be misleading when the distance between x-values matters.
It also helps to distinguish the x-axis from the vertical value axis. Changing the horizontal category labels changes what appears beneath the plotted points. It does not change the series’ y-values, which are the measurements represented by the height of the line.
Replace the horizontal axis labels
In Excel for Microsoft 365 on Windows, use the chart’s data-source controls to point the category labels at a different range:
- Click the line chart to show the chart tabs on the ribbon.
- Choose Chart Design > Select Data.
- In the Select Data Source window, find Horizontal (Category) Axis Labels and choose Edit.
- Select the worksheet cells containing the labels you want, then confirm the range selection.
- Choose OK to close the dialogs and check the chart.
You can select a range on the same worksheet or another worksheet in the workbook. For example, if the current labels are in A2:A13 and the replacement month names are in D2:D13, set the horizontal axis label range to D2:D13. The plotted values remain unchanged; only the displayed category names are replaced.
Make sure the label range has one label for each plotted point. If a chart plots 12 monthly values but you select only 10 labels, Excel may repeat, omit, or otherwise align labels in a way that does not communicate the data as intended. Select the cells that contain labels, not the header cell, unless you specifically want that header treated as a category.
Change the source data or category order
If you want to change both the labels and the values being plotted, edit the chart’s data source rather than only its label range. In Chart Design > Select Data, the Legend Entries (Series) area lists plotted series. Selecting a series and choosing Edit lets you change its name and the cells that supply its values. The Horizontal (Category) Axis Labels control remains separate, so changing a series does not automatically mean the axis labels have changed.
When data is arranged with categories down a column and series across columns, Excel will often interpret it as intended. If it has treated rows as series or columns as categories, use Chart Design > Switch Row/Column. Check the preview and series names afterward: this changes how the existing data is grouped, not the actual cell contents.
To reorder categories, reorder the corresponding rows in the source data, or use a different label range that lists them in the order you want. For a standard line chart, category order follows the source order; Excel does not generally sort category labels alphabetically just because you change their range. Reordering only the labels without reordering the values can make the chart falsely associate a value with the wrong category.
Use dates and control date spacing
If the labels are dates, Excel may display them as equally spaced categories or as dates on a date axis. To inspect the setting, right-click the horizontal axis and choose Format Axis. In the Format Axis pane, open Axis Options and look for Axis Type. Depending on the data, you can choose Automatic, Text axis, or Date axis.
A date axis positions dates according to calendar time, so a longer gap between observations can occupy more horizontal space than a shorter gap. This is often suitable for time series with missing dates or irregular intervals. A text axis treats each date as a category and spaces each entry evenly, which can be preferable when every reporting period should receive equal visual weight regardless of the number of days in it.
If Excel does not offer or apply the date behavior you expect, check the source cells. Dates stored as text may not be recognized as dates. Also consider whether the chart’s labels are a mixture of text and date values. Correct the source data or choose Text axis when the labels are intended to be categories. When Excel recognizes a date axis, the Format Axis pane can also provide base-unit choices such as days, months, or years; the options available depend on the chart and data.
When the x-values are measurements
Use an XY (Scatter) chart when x-values are genuinely numeric and their spacing matters. Examples include elapsed time in seconds, distance, temperature, or experimental concentration. A line chart’s category axis does not represent those numeric intervals proportionally, even if you replace its labels with the numbers.
To switch, select the chart and choose Chart Design > Change Chart Type. Choose X Y (Scatter), then select a subtype such as Scatter with Straight Lines and Markers if you want points connected by lines. After changing the type, open Chart Design > Select Data, select a series, and choose Edit. Set Series X values to the cells containing the numeric x-values and Series Y values to the matching measurement cells. Each pair of ranges should contain the same number of data points.
For instance, if elapsed minutes are in A2:A5 and measured readings are in B2:B5, the scatter series should use A2:A5 for X values and B2:B5 for Y values. A reading at minute 10 will then be positioned farther from minute 5 than a reading at minute 6. In a line chart, those three labels would ordinarily be three equally spaced categories. Scatter charts also let you set numeric horizontal-axis bounds through Format Axis, which is useful when you need a specific scale.
Fix common axis-label problems
- The labels do not match the points: Confirm that the selected label range starts and ends alongside the plotted data. If you sorted or moved only the labels, restore the same row order for the labels and values.
- The chart shows 1, 2, 3 instead of the intended names: Open Select Data and set Horizontal (Category) Axis Labels to the cells containing the names. Check that the names are in the selected range and are not merely in a header cell excluded from it.
- Some labels are missing: Excel may be showing only some category labels to prevent crowding. Right-click the axis, choose Format Axis, and inspect the label interval options. Showing every label can make a crowded chart hard to read, so consider shortening labels or enlarging the chart as well.
- Dates appear in an unexpected order or format: Check the worksheet’s source values and number formats. A date’s displayed format can differ from its underlying date value, and dates stored as text may not behave as dates. Format the source cells consistently and verify the axis type.
- The x-axis is at the top or crosses the chart oddly: This may be an axis-position setting or a consequence of where the vertical axis crosses. Use Format Axis to review axis options; this changes axis placement, not the source labels.
For a changing dataset, an Excel Table can make chart sources easier to maintain because charts based on table data can extend as rows are added. After converting a data range with Insert > Table, check that the chart references the table data and that newly added rows are included. If the chart uses fixed cell ranges instead, you may need to update the data source when you add records.
Line chart or scatter chart?
The choice depends on what the horizontal values mean, not just on whether they contain numbers. A line chart is a good fit when the x-axis represents ordered categories or regular reporting periods and equal spacing is acceptable. A scatter chart is a better fit when each x-value is a measurement and differences between x-values must be reflected in the plotted distance.
For example, a sales report with January, February, and March as successive periods is usually clear as a line chart. A chart of readings taken at 0, 1, 4, and 10 minutes is often better as a scatter chart because the intervals are uneven. Choosing a line chart for the second case can visually imply that the observations were equally spaced in time, even if the labels themselves are correct.
A scatter chart can still connect points with lines, so switching does not require giving up the connected-line appearance. Conversely, a line chart can show markers and look similar at a glance. The important difference is how Excel positions the horizontal values: categories in sequence for a line chart, numeric coordinates for a scatter chart.
Frequently Asked Questions
How do I change the x-axis labels without changing the data?
Choose Chart Design > Select Data, then Edit under Horizontal (Category) Axis Labels. Select the replacement label cells. This changes the labels, not the plotted series values.
Can I use numbers as the x-axis values in an Excel line chart?
You can display numbers as category labels, but a line chart generally spaces categories evenly. Use an XY (Scatter) chart if the numeric differences must determine the horizontal spacing.
Why are my dates equally spaced on a line chart?
The chart may be using a text axis, which treats dates as categories. Right-click the horizontal axis, choose Format Axis, and check Axis Type. Choose Date axis when calendar intervals should control spacing and Excel recognizes the source cells as dates.
How can I show every x-axis label?
Right-click the axis, choose Format Axis, and review the label interval setting under Axis Options. If all labels overlap, use shorter labels, a wider chart, or a smaller font rather than forcing unreadable text.
Can I change the x-axis range on a line chart?
A category axis is based on its list of categories, so use Select Data to change that list or its order. For numeric minimum and maximum bounds, use an XY (Scatter) chart and set the horizontal axis bounds in Format Axis.
Do the steps differ in Excel for Mac or Excel for the web?
In Excel for Mac, select the chart and use the Chart Design tab’s data-selection controls; ribbon placement and dialog details can differ slightly from Windows. Excel for the web has chart-editing controls, but some desktop chart options may not be available, so use the Windows or Mac desktop app if you cannot find a particular axis setting.
Related
- Excel Data Validation Lists Based on Criteria
- Excel Data Validation List: How to Add a Blank Option
- Excel Data Validation Lists: Allow Custom Input?
Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.
More in Charts & pivot tables
- Excel Chart Color Based on Value: How to Set It UpYes. In Excel for Microsoft 365 on Windows, the most reliable way to color chart points according to…
- Add a Data Table to an Excel Chart: Steps and TipsTo add a data table beneath a chart in Excel for Microsoft 365 on Windows, select the chart,…
- Excel Waterfall Chart Totals: How to Add and FormatTo show a total in an Excel waterfall chart, right-click the bar that represents the total and choose…
- Does Excel Have a Gantt Chart? How to Make OneExcel does not include a dedicated Gantt chart type, but you can make a useful Gantt-style schedule in…
- Bar Chart Formula in Excel: How to Create OneThere is no special Excel formula that creates a bar chart: a chart is an object you insert…
- Excel Pivot Table: Remove Old Filter Values After RefreshTo remove deleted items from an Excel PivotTable filter, open PivotTable Options, set Number of items to retain…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.