7 Ways To Add Data Labels in Microsoft Excel

Do you wish to learn how to add data labels in Excel to display the details of the data series or a specific data point? If yes, this effortless Excel tutorial will help you. Keep reading!

Data labels in Excel are essential for enhancing chart clarity and readability. By adding labels directly to data points, you provide viewers with immediate and precise information about the plotted data series. Thus, the audience doesn’t need to refer to the underlying table or dataset constantly.

For example, you might want to show the values of columns in a column chart in Excel or show percentages in each slice of an Excel pie chart.

Using the Add Data Labels Tool

The Data Labels tool is the default Excel feature to add data labels in any Excel chart. Also, you can access it in multiple ways so it’s the most suitable option for general tasks.

Chart Elements tool
Chart Elements tool

To practice this approach, click on the source chart and hit the Chart Elements button in the top right corner of the chart. It looks like a plus sign.

Data Labels checkbox
Data Labels checkbox

It’ll expand the Chart Elements context menu. Checkmark the checkbox for Data Labels.

Excel will add the default data labels in your chart.

Data Labels positions
Data Labels positions

If you’d like to customize the position of the data labels, hover your mouse over the Data Labels option and click on the overflow arrow.

You’ll find the following alternative locations for data labels:

  • Center
  • Inside End
  • Inside Base
  • Outside End
  • Data Callout

You can also use the same tool and steps to add a data label in a Pivot Chart in Excel.

Using a Custom Text Box

Often, you might want to highlight only a single data point in your chart. You can do that by using the Data Labels tool explained earlier. If you use that approach, you’ll need to delete the unwanted data labels from the chart one after the other.

Text Box command
Text Box command

Alternatively, you can use an Excel Text Box to add a custom data label. Since you can drag and drop a Text Box anywhere on the Excel worksheet including the chart objects, it’s the most effortless approach so far.

Go to the source Excel chart and click on the Insert tab in the Excel ribbon menu.

Click on the Text Box button inside the Text block of the Insert tab.

Drawing a Text Box
Drawing a Text Box

A modified cursor will show when you hover the mouse cursor over the chart.

Draw the Text Box using your mouse.

Typing a text in Text Box
Typing a text in Text Box

A text cursor will show. You can now type the data label as per your preference.

Click on the Text Box border and drag it to the left or right to increase the dimension to fit your text.

Text customization tool
Text customization tool

You can further customize the data label by selecting the whole text. A text customization menu will show up on the top of the Text Box.

From this tool, you can choose the following features:

  • Font
  • Font Size
  • Bold/ Italic/ Underline
  • Align Left/ Center/ Alignt Right
  • Font Color
Using Text Box fill customization
Using Text Box fill customization

You can also customize the Text Box by changing the default fill color, style, etc. To do this, click on the text. A Text Box outline will show up. Click on the Text Box border and right-click to bring up the Text Box customization tool.

Use the following tools to modify the Text Box:

  • Style
  • Fill
  • Outline

Find above a sample of custom data labels on an Excel chart.

Using Cell Range Values as Data Labels

You can use values from a specific cell range as custom labels, allowing you to display information that’s more descriptive or contextual than the default chart values. For example, instead of showing just numerical values, you could label data points with relevant text or calculated results. Also, by following this method, you can custom-label multiple data points on the chart in one go.

Sample dataset and chart 1

For instance, you want to add custom data labels for all the columns in the above graph.

Copy Category data
Copy Category data

Copy the Category data or values and paste that into another cell range.

Source for custom data labels
Source for custom data labels

Now, enter the custom data labels you want in the cell range next to the copied Category data.

Add data labels for all the columns in the source chart by following the first method explained above in this Excel tutorial.

Format Data Labels
Format Data Labels

Select any one of the data labels on the chart to select all. Right-click and select Format Data Labels from the context menu.

Value From Cells
Value From Cells

A navigation panel will show up on the right side. This is the Format Data Labels toolbox.

There, you should see the Label Contains section with six checkboxes. Checkmark the Value From Cells checkbox.

Data Label Range
Data Label Range

The Data Label Range dialog box will show up. Click on the Select Data Label Range field and highlight the cell range from which you want to import custom data labels.

Data labels with values from cell range
Data labels with values from cell range

Excel will update the chart’s data labels with the new data as well as the existing values.

Uncheck Value
Uncheck Value

Now, go to the Format Data Labels toolbox again and uncheck the checkbox for Values.

Using a Custom Number Format as Data Labels

By applying a custom format, you can control the number of decimal places, add symbols, include text, or even create conditional formatting and display these as data labels.

For example, you might want to display currency values with a dollar sign and two decimal places, percentages without the percent symbol, or dates in a specific format. Custom number formats provide the flexibility to achieve these and many other formatting options.

The best thing about this approach is the custom number formatting only impacts the display of data labels. You never change the underlying dataset.

Sample dataset and chart 2

In the Excel chart shown above, you can see pricing is displayed as plain digits. You can transform these data labels to any currency format along with one or two decimal places for enhanced readability and clarity.

Format data labels in chart
Format data labels in chart

To use a custom number formatting in this chart, select the existing data labels by clicking on any data point.

Right-click and select Format Data Labels from the context menu.

The Format Data Labels toolbox will show up on the right.

Expand Number tree
Expand Number tree

Scroll down on the toolbox to find the Number menu. Click on the left-side arrow to expand it.

Custom number Category
Custom number Category

Click on the Category drop-down menu and choose Custom.

Format Code Apply
Format Code Apply

Enter the following custom number formatting code inside the Format Code field:

$#,##0.00

Click the Add button to apply the new number formatting style.

Custom number formatting code
Custom number formatting code

You’ll see the updated data labels on the selected chart.

Using Excel VBA Editor

The Excel VBA-based method helps you to automate the manual and repetitive task of adding data labels. You can create several Excel VBA macros and run those in appropriate situations to install and apply data labels with custom styles and conventions.

In this section, you’ll find a few Excel VBA scripts for developing macros along with illustrations to show the performance of these macros.

Before you can create a macro, check out the following Excel tutorial to learn how to set up a macro in Excel using VBA:

📒 Read More: How To Use The VBA Code You Find Online

Now, try the following VBA scripts to automate data labels in any chart in Excel:

Add Data Labels for All Data Series

Use this VBA script to add data labels to all the data series in your chart:

Excel VBA script 1
Sub AddDataLabelsToChart()
    Dim chartName As String
    Dim chartObj As ChartObject
    Dim seriesCount As Integer
    Dim i As Integer
    Dim labelColor As String
    Dim colorCode As Long
    
    chartName = InputBox("Enter the name of the chart object:")
    
    On Error Resume Next
    Set chartObj = ActiveSheet.ChartObjects(chartName)
    On Error GoTo 0
    
    If chartObj Is Nothing Then
        MsgBox "Chart not found. Please check the name and try again."
        Exit Sub
    End If
    
    seriesCount = chartObj.Chart.SeriesCollection.Count
    
    If seriesCount = 1 Then
        With chartObj.Chart.SeriesCollection(1)
            .HasDataLabels = True
            .DataLabels.Font.Color = RGB(0, 0, 139)
        End With
    Else
        For i = 1 To seriesCount
            labelColor = InputBox("Enter the color for data labels of series " & i & " (e.g., Red, Blue, Green):")
            Select Case LCase(labelColor)
                Case "red"
                    colorCode = RGB(255, 0, 0)
                Case "blue"
                    colorCode = RGB(0, 0, 255)
                Case "green"
                    colorCode = RGB(0, 255, 0)
                Case Else
                    MsgBox "Invalid color. Defaulting to black."
                    colorCode = RGB(0, 0, 0)
            End Select
            With chartObj.Chart.SeriesCollection(i)
                .HasDataLabels = True
                .DataLabels.Font.Color = colorCode
            End With
        Next i
    End If
    
    MsgBox "Data labels have been added to the chart."
End Sub
Macro dialog box
Macro dialog box

Once you’ve created a macro using this script, press Alt + F8 to launch the Macro dialog box.

Select AddDataLabelsToChart from the list of macros and hit the Run button.

The script will show a series of dialog boxes to collect information from you to appropriately add data labels in the Excel chart. Find below the input boxes along with screenshots:

Chart name box
Chart name box
  • Enter chart object name: You can find this by clicking on the chart and looking at the Name box in the top left corner of the worksheet.
Enter a color code
Enter a color code
  • Input boxes for colors of label texts: Here, you must enter the font color for the data labels. These dialog boxes will appear for all the chart data series.
Confirmation box
Confirmation box
  • Confirmation dialog: The last dialog box confirms the acceptance of input values. Once you close it, the data labels will show up.
How to add data labels in Excel using VBA
How to add data labels in Excel using VBA

The above is an example of an Excel chart with data labels added using the Excel VBA Editor.

Add Data Label for Select Series

You might also want to add data labels for a specific series index in an Excel chart. Use this VBA script to set up a macro that does so:

Excel VBA script 2
Sub AddDataLabelsToChart()
    Dim chartName As String
    Dim chartObj As ChartObject
    Dim seriesCount As Integer
    Dim seriesIndex As Integer
    Dim seriesName As String
    Dim series As series

    ' Prompt user to enter the chart name
    chartName = InputBox("Enter the name of the chart object:")

    ' Check if the chart object exists
    On Error Resume Next
    Set chartObj = ActiveSheet.ChartObjects(chartName)
    On Error GoTo 0

    If chartObj Is Nothing Then
        MsgBox "Chart object not found. Please check the name and try again."
        Exit Sub
    End If

    ' Get the number of series in the chart
    seriesCount = chartObj.Chart.SeriesCollection.Count

    ' Prompt user to enter the series index
    seriesIndex = InputBox("Enter the series index (1 to " & seriesCount & "):")

    ' Validate the series index
    If seriesIndex < 1 Or seriesIndex > seriesCount Then
        MsgBox "Invalid series index. Please enter a number between 1 and " & seriesCount & "."
        Exit Sub
    End If

    ' Add data labels to the specified series
    Set series = chartObj.Chart.SeriesCollection(seriesIndex)
    series.ApplyDataLabels

    ' Confirmation message
    MsgBox "Data labels added to series " & seriesIndex & " successfully!"
End Sub

The above script will scan the chart object to extract its series indexes. Then, it’ll show the following dialog boxes for you to input data:

Input box for chart name
Input box for chart name
  • Type in the chart object name.
Input box for series index number
Input box for series index number
  • Enter the series index number for data labels.
Add data labels for specific series index
Add data labels for specific series index

Excel adds the data labels as soon as you interact with the last dialog box.

Using Office Scripts

Are you using Excel for Microsoft 365 desktop or web app and have a Microsoft 365 Business Standard or better subscription? You can use Office Scripts to automate various Excel activities including adding data labels in a chart.

Office Scripts also allows you to add data labels to graphs in Excel remotely using Power Automate without even opening the workbook.

Code Editor
Code Editor

Do you see the Automate tab on your Excel desktop or web app? Congratulations! You can follow these steps to practice this method.

On the source chart’s worksheet, go to the Automate tab and click on the New Script command inside the Scripting Tools block.

The Office Scripts Code Editor panel will open on the right side. Into the code editor, copy and paste the following script:

function main(workbook: ExcelScript.Workbook) {
    // Get the active worksheet
    let sheet = workbook.getActiveWorksheet();

    // Get all charts in the active worksheet
    let charts = sheet.getCharts();

    // Loop through each chart and add data labels
    charts.forEach(chart => {
        let dataLabels = chart.getDataLabels();
        dataLabels.setShowValue(true); // Show the value on the data labels
    });
}
Add data labels using Office Scripts
Add data labels using Office Scripts

Click on the Save script button. You can assign a new name when saving the code.

Now, hit Run to execute the script.

Excel will add data labels to all the data series of all the charts in the worksheet.

Add Data Labels in Excel for Mac

The approach to adding data labels in a chart in Excel for Mac is slightly different than the Windows Excel app.

For instance, you won’t find the Chart Elements menu on the chart.

Outside End

Instead, you need to select the source chart object to bring up the Chart Design tab on the ribbon menu.

Then, you can click on the Chart Elements button in the Chart Layouts block.

Now, hover the cursor over the Data labels menu to expand its submenu.

Select a position for the data labels, like Outside End.

Data labels in Excel for Mac
Data labels in Excel for Mac

Excel for Mac will add the data labels for all the data series indexes of the chart.

Conclusions

So far, you’ve learned how to add data labels in Excel using various methods, involving Excel user interface tools, Excel VBA Editor, and Office Scripts.

Practice and use the method you like and match your charting requirements in Excel.

If the article helped you or to share feedback, comment below.

About the Author

Bipasha Nath

Bipasha Nath

Bipasha is a technical content writer with 10+ years of experience in the technology industry. She previously worked in a SaaS software development company focused on SharePoint, OneDrive, Word, Excel, Word solutions.

Related Posts

Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get the Latest Microsoft Excel Tips

Follow Us

Follow us to stay up to date with the latest in Microsoft Excel!

Subscribe for awesome Microsoft Excel videos 😃