Chart & Visualization Issues

Match Excel Pie Chart Label Font Colors to Source Cells

Ayan MasoodAyan Masood Nov 14, 2026 871 views

Question details

The user wants each Excel pie chart data label to use the same font color as its corresponding source cell.

Product
Microsoft Excel
Device & OS
not provided
Scenario
A pie chart has data labels that should visually match the font colors of cells associated with its data points.
Observed behavior
Each data label should display the font color of its corresponding source cell.
Before you start

Identify the cells whose font colors you want to copy and confirm that their order matches the pie slices. For the VBA method, use desktop Excel and save the workbook as a macro-enabled .xlsm file.

Solution 1Recommended

Use VBA to copy source-cell font colors to pie chart labels

Use this method to apply multiple source-cell font colors to corresponding labels in one operation.

The macro uses the selected chart's first series and applies colors in the order of the selected cells. It copies font colors, not cell fill colors or conditional-formatting display colors.

1
Open the VBA editor

In desktop Excel, open the workbook, then select Developer > Visual Basic. If Developer is hidden, enable it in Excel's ribbon settings.

2
Add the macro

In the VBA editor, select Insert > Module and paste this code: Sub MatchPieLabelColors() Dim ch As Chart Dim ser As Series Dim rng As Range Dim cel As Range Dim i As Long Set ch = ActiveChart If ch Is Nothing Then MsgBox "Select the pie chart first." Exit Sub End If Set ser = ch.SeriesCollection(1) On Error Resume Next Set rng = Application.InputBox("Select the source cells in pie-slice order.", Type:=8) On Error GoTo 0 If rng Is Nothing Then Exit Sub If rng.Areas.Count <> 1 Or rng.Cells.Count <> ser.Points.Count Then MsgBox "Select one contiguous range with one cell per pie slice." Exit Sub End If ser.HasDataLabels = True i = 1 For Each cel In rng.Cells ser.Points(i).DataLabel.Font.Color = cel.Font.Color i = i + 1 Next cel End Sub

3
Select the chart and run the macro

Return to the worksheet and click the pie chart. Choose Developer > Macros, select MatchPieLabelColors, and click Run.

4
Select the source cells

In the prompt, select one contiguous range with one cell per pie slice, in the same order as the chart points, and click OK.

Run the macro again after changes: The colors do not update automatically when source-cell formatting changes. Run the macro again after changing the colors or chart data. Enable macros only for workbooks you trust.
Format pie chart labels in WPS

Match pie chart label colors in WPS Spreadsheet

Use WPS Spreadsheet to open your workbook and manually apply each source-cell font color to its corresponding pie chart label.

  1. 1. Open the workbook: Open WPS Spreadsheet and select Open to load the Excel workbook containing the pie chart.
  2. 2. Check the source color: Select the first source cell and inspect Home > Font Color. Note the color you want to apply to its label.
  3. 3. Select the corresponding label: Click a pie chart data label, then click the corresponding label again to select that label individually.
  4. 4. Apply and repeat: Choose the matching color from Home > Font Color. Repeat for the remaining source cells and labels.
Format individual pie chart data labels to match source-cell colorsOpen and edit Microsoft Excel XLSX workbooksUse familiar spreadsheet and chart formatting controlsWork with a free, easy-to-use office suite
microsoft office alternative - wps office

Frequently Asked Questions

Can Excel automatically link a data label's font color to a cell?

The VBA method copies the colors when you run it; it does not create a live formatting link. Run Developer > Macros > MatchPieLabelColors again after changing the source colors.

Does the macro copy cell fill colors?

No. It uses each cell's Font.Color property. Matching the background fill instead would require modifying the macro to read the cell's Interior.Color.

What if the labels receive the wrong colors?

Run the macro again and select a contiguous source range whose cells appear in the same order as the pie chart points. The range must contain one cell for each point in the first series.

Can I use the VBA method in Excel for the web?

No. Open the workbook in desktop Excel to add and run the VBA macro. Save it as an .xlsm file to retain the macro.