This elaborate Microsoft Excel tutorial will help you learn how to edit axis labels in Excel with complete mastery.
Ever look at a graph and have no idea what it’s trying to show? That’s because charts without labels on the axes (the X and Y lines) are confusing. Even worse, charts with wrong labels can be misleading!
This can make people question your data or your understanding of the information. Plus, if your chart doesn’t turn out how you pictured it, that can be frustrating.
The good news is, there’s an easy fix! Learning how to edit horizontal and vertical axis labels in Excel is a key skill for making clear and informative charts. This lets you tell a story with your data, not just show a bunch of numbers.
Don’t worry, you won’t need all day! Even if you’ve never edited axis labels before, this guide will walk you through everything you need to know in under an hour. By the end, you’ll be a chart-labeling pro!
📒 Read More: 7 Ways to Add Chart Axis Labels in Microsoft Excel
Using the Format Axis Tool
The Format Axis pane contains all visual and technical parameters for your chart’s Y and X axes. It’s located on the right-side border of the Excel app when activated.
You can do the following edits on axis labels:
- For the vertical axis label, you can adjust the values by customizing the Bounds and Units options. By default, Excel would automatically choose the mathematically appropriate bounds by analyzing the input values for the Series axis.
- You can manually change the default values of the Category or horizontal axis label. I’ll describe that later in this tutorial. Also, you can use the Format Axis tool’s Axis Options sub-tool to customize various technical aspects of the Category axis label.
Let me show you a few Y-axis label edits that are mandatory to make the default chart more attractive and meaningful.
For example, when you use the dataset in A1:B12
to insert a single series line chart, you get the chart shown in the screenshot.
In the above chart, the values for the bounds aren’t optimized. Hence, the data labels and the trend line are at the top of the chart. It has more empty space than visual information. Here, you can edit the Y-axis label parameters to make the graph more acceptable.
Firstly, double-click on the values in the vertical axis label to bring up the Format Axis panel.
The tool should automatically select the Axis Options menu for technical customizations.
There, you can make the following edits:
Bounds
Since all cartesian charts start from 0
, you can keep the Minimum value in the default range. However, change the Maximum value higher to the top value in your dataset so the trendline comes closer to the midpoint. You can try 2.5
points for the example dataset shown above.
Units
The default axis label is cluttered with many unit values. You can declutter it by increasing the value in the Major field. Try 0.5
, which gives an adequate view of the data labels in less space.
Display units
Click on the drop-down menu to choose various levels of decimal points for the values used in the axis label. For example, if you choose Hundreds, 2.5
will be expressed as 0.025
. As you change this value, watch out for the trend line data labels as well because those will also start showing decimal points. Consequently, the trendline will also look cluttered.
Tick Marks
By default, the axis label won’t show any tick marks. You’ll need to add Major and Minor tick marks manually by clicking the respective drop-down menus. You can choose from three tick mark positions. These are Inside, Outside, and Cross.
The Axis Options features for the Category axis are a bit different. If you need to edit the technical parameters of this axis label, double-click on it to get the Format Axis pane.
Click on the Axis Options icon. It looks like a column chart. It’s the fourth menu in the pane.
Expand the Axis Options menu by clicking on it. It’ll show the following customizations:
- Axist type: Automatic, Text, and Date
- Vertical axis crosses: Automatic, At a custom category number, like
2
, and At maximum category - Axis position: On tick marks or Between tick marks
If you need Tick Marks on the horizontal axis label, you can expand the Tick Marks menu on Format Axis and choose appropriate values for the following items:
- Interval between marks: Should be any number but not more than the total Category points in the chart
- Major and Minor type: Choose from Inside, Outside, and Cross
📒 Read More: 5 Ways to Switch the X and Y Axis in Microsoft Excel
Using the Category Values in the Worksheet
By default, Excel uses the values or texts from the input dataset of a chart to create the horizontal axis label.
So, you can edit the contents of the input dataset to edit the Category axis label.
To locate the column for the Category axis values, click on the chart and right-click.
From the context menu that opens, choose Select Data.
The Select Data Source will open. The values or texts on the right side of the dialog box create the Category axis label.
By looking at that, you can identify which column contributes to the Category axis label.
You can now directly edit the contents of the column with new values or texts.
The Category axis label will update dynamically.
Using the Axis Labels Edit Tool
Often, you might want to display a Category axis label in the chart that’s different from the input data. Here, the Axis Labels editing tool comes in handy.
This tool allows you to remove the default label and type in any custom value or text as you require.
For example, in the above dataset, months have been expressed in 1
, 2
, 3
, 4
, 5
, and 6
instead of Jan
, Feb
, Mar
, Apr
, May
, and Jun
.
So, when you create a line chart using this data, the X-axis (Category) labels show 1
, 2
, 3
…
However, it would make more sense if you use Jan
, Feb
, Mar
…
To display calendar months instead of the numerical denominators of months, go to the Select Data Source dialog box by right-clicking on the chart.
Click on the Edit button below the Horizontal Axis Labels list.
The Axis Labels dialog box will open.
Into the Axis Labels field, type in the custom Category axis label values as shown below:
Jan,Feb,Mar,Apr,May,Jun
Click OK to apply the changes.
You should see the custom Category label values have already shown up below the Horizontal Axis Labels list.
Click OK to include the new labels in the chart.
Editing Label Position for All Axes
Both the Y and X-axis labels for a chart, by default, show up to the left and at the bottom respectively. However, if you wish to display it in different positions, you can use the Labels sub-menu of the Axis Options in the Format Axis tool.
In the line chart shown above, the axis labels are in the default position.
Suppose, you wish to reposition the label near the higher or lower values of the chart.
Open the Format Axis tool by double-clicking on the Y-axis (Series) label.
Click on the Axis Options menu icon and expand the Labels menu.
You’ll see the Next to Axis drop-down menu. Click on that to choose other options, like High, Low, or None.
If you select High, Excel will shift the Series axis label on the top of the chart.
To change the label position for the Category axis, simply click on the X-axis.
The Format Axis tool will automatically navigate to the Labels menu for the Category axis label.
Now, you can change its position on the chart by clicking the Next to Axis drop-down.
Editing the Number Format
Usually, Excel matches the number formatting of the Series axis labels to that of the input dataset.
However, if that doesn’t happen for any reason, you can manually fix it from the Number menu of the Format Axis tool.
For example, in the above chart, the number formatting for the data labels of the trend line is in the Currency format. However, the Series axis labels don’t reflect that.
To fix this, click on the Y-axis labels. Axis Options should open automatically in the Format Axis pane. If not, navigate to Axis Options.
Click the Number menu arrow to expand its options.
Click the General drop-down menu to see all number formatting options.
Select the Currency option from the context menu. The Y-axis labels should reflect the number formatting you’ve just selected.
You can follow the same steps to customize the number formatting for the Category axis labels.
Editing Style of Axis Label Data Points
Do you want to give the axis labels a more stylish look than the default one? You can use the Shape Styles and WordArt Styles in the Format tab.
The Format tab isn’t visible by default. You must click on the chart object or any of the axis labels to see this tab.
Suppose, you want to customize the shapes of the axis label points so they become prominent. Click on the Shape Effects drop-down menu and choose the Offset: Bottom option from the Shadow menu.
Now, click on the Shape Fill drop-down and choose a color from the context menu.
If you wish to customize the font of the axis labels, click the Quick Styles arrow in the WordArt Styles commands block.
You can now choose a style from the Quick Styles context menu.
Using Excel VBA
You can edit the Y and X-axis labels in Excel automatically with interactive inputs using Excel VBA.
You only need to implement the VBA scripts mentioned here into VBA macros. To learn the technique first, follow along with this Excel tutorial:
📒 Read More: How To Use The VBA Code You Find Online
Edit Series Axis Labels
Use this VBA script to edit various technical elements of the Y-axis labels with visual prompts:
Sub EditAxisLabels()
Dim ws As Worksheet
Dim cht As Chart
Dim sourceChart As String
Dim minBound As Double
Dim maxBound As Double
Dim majorUnit As Double
Dim minorUnit As Double
Dim useLogarithmicScale As Boolean
Dim showLabelsNextToAxis As Boolean
' Get the active worksheet
Set ws = ActiveSheet
' Prompt for source chart
sourceChart = InputBox("Enter the source chart name:")
' Prompt for bounds
minBound = InputBox("Enter the minimum bound:")
maxBound = InputBox("Enter the maximum bound:")
' Prompt for major and minor units
majorUnit = InputBox("Enter the major unit:")
minorUnit = InputBox("Enter the minor unit:")
' Confirm logarithmic scale
useLogarithmicScale = MsgBox("Use logarithmic scale?", vbYesNo) = vbYes
' Confirm labels position
showLabelsNextToAxis = MsgBox("Show labels next to axis?", vbYesNo) = vbYes
' Assuming you have an existing chart named "MyChart" on the active sheet
On Error Resume Next
Set cht = ws.ChartObjects(sourceChart).Chart
On Error GoTo 0
If Not cht Is Nothing Then
With cht
' Set axis properties
.Axes(xlValue).MinimumScale = minBound
.Axes(xlValue).MaximumScale = maxBound
.Axes(xlValue).majorUnit = majorUnit
.Axes(xlValue).minorUnit = minorUnit
.Axes(xlValue).Logarithmic = useLogarithmicScale
.Axes(xlValue).TickLabelPosition = IIf(showLabelsNextToAxis, xlTickLabelPositionNextToAxis, xlTickLabelPositionHigh)
End With
MsgBox "Axis labels updated successfully!", vbInformation
Else
MsgBox "Chart not found. Make sure the chart name is correct.", vbExclamation
End If
End Sub
Upon running the script, you’ll get the following prompts. Interact with the prompts appropriately to edit the Series axis labels:
- Enter source chart name: For example Chart 1, Chart 2, etc. You can click on the target chart on the worksheet to find its name in the Name Box.
- Select maximum bound
- Choose the major unit
- Select whether you want labels next to the axis or not
Excel customizes the Y-axis according to your inputs.
Edit Category Axis Labels
You can use this script to edit the X-axis labels using a custom input:
Sub UpdateCategoryAxisLabels()
Dim ws As Worksheet
Dim cht As Chart
Dim chartName As String
Dim customLabels As String
Dim labelArray() As String
Dim i As Long
' Prompt for chart name
chartName = InputBox("Enter the chart name (e.g., Chart 1):")
' Prompt for custom category axis labels
customLabels = InputBox("Enter custom category axis labels (comma-separated):")
labelArray = Split(customLabels, ",")
' Find the chart on the active sheet
On Error Resume Next
Set ws = ActiveSheet
Set cht = ws.ChartObjects(chartName).Chart
On Error GoTo 0
If Not cht Is Nothing Then
' Update category axis labels
With cht.Axes(xlCategory, xlPrimary)
.CategoryType = xlCategoryScale
.CategoryNames = labelArray
End With
MsgBox "Category axis labels updated successfully!", vbInformation
Else
MsgBox "Chart not found. Please check the chart name.", vbExclamation
End If
End Sub
As you run the script, Excel will show an input box so you can enter the source chart name.
There will be another prompt where you can enter the text string or numerical values for the X-axis labels.
Excel will instantly modify the target axis labels.
Conclusions
If you’re here, congratulations! You’ve learned how to edit axis labels in Excel using various manual and automated methods.
If you liked this Excel tutorial, comment below to share your acknowledgment. Know a better technique for editing X or Y-axis labels in Excel? Share your tips or suggestions in the comment box.
0 Comments