Function Problems

How to Count Duplicate Values in Excel Without Listing Them Manually

Chanuka GeekiyanageChanuka Geekiyanage Nov 13, 2026 872 views

Question details

Count how often each customer or code appears in a large Excel column without manually specifying each value.

Product
Microsoft Excel
Device & OS
not provided
Scenario
A column contains repeated customer names or codes, and the user needs occurrence counts for all values.
Observed behavior
The desired result is either a summary with one row per distinct value or an occurrence count beside each original row.
Before you start

Give the customer or code column a header, and check for extra spaces or inconsistent formatting that could split matching values. Decide whether you want a separate summary or counts alongside the original data.

Solution 1Recommended

Create a PivotTable to summarize counts for each distinct value

Use this method to generate one row per customer or code automatically, with its total occurrence count.

1
Select the source data

Click a cell in your customer or code column, then select Insert > PivotTable. Confirm that the source range includes the header and all data rows, choose New Worksheet, and click OK.

2
Add the field to Rows and Values

In the PivotTable Fields pane, drag the customer or code field into Rows, then drag the same field into Values.

3
Set the calculation to Count

Open the field's drop-down menu in the Values area, select Value Field Settings, choose Count under Summarize Values By, and click OK.

4
Show only repeated values if needed

To hide values that occur only once, open the Row Labels drop-down, select Value Filters > Greater Than, choose the count field, enter 1, and click OK.

Create a PivotTable to summarize counts for each distinct value
Refresh after source changes: Right-click the PivotTable and choose Refresh after changing the source data. If you add rows beyond a fixed source range, use PivotTable Analyze > Change Data Source to include them before refreshing.
Count repeated values in WPS Spreadsheet

Count Customer and Code Occurrences in WPS Spreadsheet

Open your Excel workbook in WPS Spreadsheet and use COUNTIF to calculate occurrence counts beside each customer or code, without manually creating a list of values.

  1. 1. Open the workbook: Launch WPS Spreadsheet and choose Open to load your Excel workbook.
  2. 2. Add a count column: If the customer names or codes are in column A, click B1 and type Occurrence Count.
  3. 3. Enter COUNTIF: Click B2, type =COUNTIF(A:A,A2), and press Enter.
  4. 4. Fill and save: Drag B2's fill handle down through the remaining data rows, then choose Menu > Save As and select Excel Workbook (.xlsx) to save a compatible copy.
Count repeated customers or codes with COUNTIF.Open and save Microsoft Excel .xlsx and .xls files.Keep the original list while adding counts in an adjacent column.Use familiar spreadsheet formulas and fill-handle controls.
microsoft office alternative - wps office

Frequently Asked Questions

Can Excel create a count summary without a manually typed list of customers?

Yes. Select Insert > PivotTable, place the customer field in both Rows and Values, and set Value Field Settings to Count. Excel generates the distinct customer labels automatically.

Why does my PivotTable show Sum instead of Count?

Excel may default to Sum when the code field contains numbers. Open the field's menu in the Values area, select Value Field Settings, choose Count, and click OK.

Does COUNTIF count the first occurrence as well as the duplicates?

Yes. =COUNTIF(A:A,A2) returns the total number of matching cells, including the current occurrence. A result of 1 means the value appears once; a result greater than 1 means it is repeated.

How do I avoid counting empty rows?

In B2, use =IF(A2="","",COUNTIF(A:A,A2)) and fill it down. This leaves the result blank when the corresponding cell in column A is empty. In a PivotTable, open the Row Labels filter and exclude the blank item.

Why are two identical-looking customer names counted separately?

Extra spaces or hidden characters can make text values different. For ordinary extra spaces, enter =TRIM(A2) in an empty column and fill it down, then use the cleaned column as the source for your counts. COUNTIF does not distinguish uppercase from lowercase.