Table of Contents
To keep only the duplicate values in Excel, you can use the conditional formatting feature. This allows you to highlight duplicate values and then delete them if desired. Alternatively, you can use the remove duplicates function under the Data tab to automatically delete all duplicate values in a selected range. This will help maintain data integrity and avoid any errors or inconsistencies in your Excel spreadsheet.
Only Keep Duplicate Values in Excel (With Example)
Often you may want to only keep duplicate values in a dataset in Excel.
For example, suppose you have the following dataset that contains the names of various basketball teams:

Suppose you’d like to filter the dataset so that only the teams with duplicate values are kept in the dataset.
The following example shows exactly how to do so.
Example: Only Keep Duplicate Values in Excel
First, we need to identify the rows with team names that occur more than once.
To do so, we can type the following formula into cell B2:
=COUNTIF($A$2:$A13,$A2)>1
The following screenshot shows how to use this formula in practice:

This formula checks if each team name in column A occurs more than once.
If the team name does occur more than once, the formula returns TRUE.
Otherwise, the formula returns FALSE.
Next, we can type the following formula into cell D2 to filter the values so that only the team names that occur more than once are kept:
=FILTER(A2:A13, B2:B13=TRUE)
The following screenshot shows how to use this formula in practice:

Noticed that the filtered dataset only contains the rows for the teams that occur more than once.
For example, the following teams have all been filtered out:
- Spurs
- Kings
- Warriors
- Wizards
- Heat
Each of these team names only occurred once in the original dataset.
Note that we used the FILTER function to filter column A for rows where the corresponding value in column B was TRUE.
This allowed us to filter the original list to only contain the values in the Team column for any team that occurred more than once.
The following tutorials explain how to perform other common tasks in Excel:
Cite this article
stats writer (2024). How can I keep only the duplicate values in Excel?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-keep-only-the-duplicate-values-in-excel/
stats writer. "How can I keep only the duplicate values in Excel?." PSYCHOLOGICAL SCALES, 22 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-keep-only-the-duplicate-values-in-excel/.
stats writer. "How can I keep only the duplicate values in Excel?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-keep-only-the-duplicate-values-in-excel/.
stats writer (2024) 'How can I keep only the duplicate values in Excel?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-keep-only-the-duplicate-values-in-excel/.
[1] stats writer, "How can I keep only the duplicate values in Excel?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I keep only the duplicate values in Excel?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
