Create a Dynamic Duplicate Count List for an Excel Pie Chart
Question details
Create a dynamic list of values and their counts for a pie chart, excluding blank cells from the legend.

- Product
- Microsoft Excel for Microsoft 365
- Device & OS
- not provided
- Scenario
- A user wants to chart the frequency of values in a range that may change over time.
- Observed behavior
- The chart should display nonblank values and their counts, updating as the source data changes.
Confirm that your Excel version supports UNIQUE, FILTER, and spilled array references. The example uses source data in A2:A100 and empty output columns D and E on Sheet1.
Create a dynamic count list and pie chart in Excel
Use spilled formulas and named ranges to keep the chart aligned with the nonblank values and their counts.
The formulas count every nonblank distinct value, including values that appear only once. Keep the spill areas below D2 and E2 clear, and make sure the source range contains at least one nonblank value.
In D2, enter =UNIQUE(FILTER(A2:A100,A2:A100<>"")) to spill the distinct nonblank labels down column D.
In E2, enter =COUNTIF(A2:A100,D2#) to spill the corresponding counts. Expand A2:A100 in both formulas if your source extends beyond row 100.
Go to Formulas > Name Manager > New. Create the workbook-level name ChartLabels with =OFFSET(Sheet1!$D$2,0,0,COUNTA(Sheet1!$D$2#),1), then create ChartCounts with =OFFSET(Sheet1!$E$2,0,0,COUNTA(Sheet1!$D$2#),1). Replace Sheet1 with your actual sheet name.
Select the current labels and counts in columns D and E, then choose Insert > Pie Chart and select a pie chart style.
Right-click the chart and choose Select Data. Edit the series values to use =Book1.xlsx!ChartCounts, and edit the category labels to use =Book1.xlsx!ChartLabels. Replace Book1.xlsx with your workbook name.

Build a nonblank value-count chart in WPS Spreadsheets
Use supported dynamic array formulas to list nonblank values and count them, then insert a pie chart from the results. Check formula support in your WPS version and adjust the chart range if the list grows.
- 1. Open the workbook: Open your Excel workbook in WPS Spreadsheets and identify the source range, such as A2:A100.
- 2. Generate labels: In D2, enter =UNIQUE(FILTER(A2:A100,A2:A100<>"")) if your WPS version supports these dynamic array functions.
- 3. Calculate counts: In E2, enter =COUNTIF(A2:A100,D2#) if your version supports spilled range references.
- 4. Create the chart: Select the populated cells in columns D and E, then choose Insert > Chart and select a pie chart. Update the chart's data range if the spilled list grows beyond it.

Frequently Asked Questions
Why does the formula show a spill error?
Clear any cells below D2 or E2 that block the results, then check that the formulas are outside any Excel table.
Why am I getting a calculation error when the source is blank?
FILTER has no nonblank values to return. Enter at least one value in A2:A100 before using the results as a chart source.
Will the chart include values that appear only once?
Yes. UNIQUE lists every distinct nonblank value, and COUNTIF returns its frequency, including counts of one.
What happens if I add data below row 100?
The example formulas only check A2:A100. Edit both formulas to include the additional rows, or use a suitable Excel table column as the source.




