Microsoft Excel is a widely used application, but it can be a little confusing when it comes to removing and eliminating duplicate data. Removing duplicates in Excel is a prevalent task for people working on huge datasets. When you combine different tables, or when many people have access to the same document, you might end up having repeated entries in your spreadsheet. Thus, making the data redundant. The larger the dataset, the higher are the chances of encountering duplicate records. It can be problematic if they are not identified and handled correctly.Ā
We will illustrate how to remove duplicates in Excel using a Sports dataset. This dataset contains information about Olympic medalists for the year 2012.Ā
Using Remove Duplicates Option on Data Tab
Excel has a built-in tool that helps delete repeated entries in your dataset. Letās have a look at the steps to be followed to remove duplicates in Excel.
- First, click on any cell or a specific range in the dataset from which you want to remove duplicates. If you click on a single cell, Excel automatically determines the range for you in the next step.
- Ā Next, locate the āRemove Duplicatesā option and select it.
Ā DATA tab ā Data Tools section ā Remove Duplicates
- Ā A dialog box appears, as shown below. You can select the columns you want to compare and check for duplicate data.Ā
In case your data consists of column headers, select the āMy data has headersā option, and then click on OK.Ā
On checking the header option, the first row will not be considered for removing duplicate values.
- Ā Excel will now delete the duplicate rows and display a dialog box. The dialog box shows a summary of how many duplicate values are found and removed along with the count of unique values.Ā
- Ā As you can notice, the duplicate records are removed.
Let's move forward and understand how to remove duplicates in Excel using the Advanced Filter option.Ā
Using the Advanced Filter Option
The Advanced Filter option in Excel helps you filter duplicate values and copy the unique values to a different location. Look at the following steps to find out how the Advanced Filter option works.
- First, click on a cell or range in the dataset from which you want to remove duplicates. If you click on a single cell, Excel automatically determines the range when you click on Advanced Filter.
- Locate the Advanced Filter option.
DATA tabĀ ā Sort & Filter section ā Advanced and click on it.
- Ā You will see a dialog box. It consists of a list of options for advanced filtering.
- Select the āCopy to another locationā option to copy the unique values to a different location.
- Check the range of your records in the āList Rangeā field and make sure it is the range that you have specified.
- In the āCopy to:ā field, enter the range where the resultant unique values must be copied.
- Check the āUnique records onlyā box. This step is the most crucial.
- Click on OK.
- Ā The unique values will be copied to cell G1.
These were the in-built functionalities in Excel that help us in removing duplicates. Now, letās move forward and learn how we can create our own function to do the same.Ā
How to Use Formulas to Remove Duplicates in Excel?
We will be using a simple example containing the columns: type of sport, athlete name, and medal won to demonstrate this approach.
This method involves combining the columns using an Excel formula and finding out the count. We will then filter out the duplicate values (ones that have a count greater than 1).Ā
- Letās combine the columns A, B, and C by using the concatenation operator ā&ā. So, the Excel formula would be:
=A2&B2&C2
This formula is entered into the cell D2 and then copied down to all the rows.Ā
- Now, we will need another column named āCountā to find out the duplicates in Column D. Hence, we use the COUNTIF function on cell E2. The formula will be:
=COUNTIF($D$2:D2,D2)
This formula helps count the number of occurrences of each value in column D.
If the value of Count is ā1ā, then it has only appeared once and is unique. If the value is ā2ā or more, then it is considered a duplicate value.
- Now add a filter to the Count column by selecting the Filter option.
You will find it in the DATA tab ā Sort & Filter section ā Filter
Click on the filter at the top of Column E. Select ā1 ā to keep only the unique values and remove the duplicates.Ā Ā
- On clicking OK, the duplicate values will be removed from the table. You can copy these resultant unique records and paste them elsewhere.
Letās proceed by understanding the final approach to delete duplicates: Using Power Query.Ā
How to Use the Power Query Tool to Remove Duplicates in Excel?
Power Query in Excel lets you import data from various sources, clean and transform your data. This tool makes it effortless to remove duplicates in Excel.
- Select a cell or range, locate Data TabĀ āĀ Get & Transform Data sectionĀ āĀ From Table/Range and click on it.
- On clicking, you will see a dialog box to create a power query table. Make sure that the range of values is correctly specified. Click on OK.
- The following Power Query editor window appears.
Now you have two options. You can remove duplicates based on:
- One or more columns
- Entire table
To remove duplicates based on one or more columns, right-click on the specific column header. You can select more than one column using the CTRL button and remove the duplicates accordingly.Ā
To remove the duplicate records based on the entire table, click on the button present on the top left corner of the data preview. And then select the āRemove Duplicatesā option.Ā
This way, the data will be free from duplicate values.
On clicking the āClose & Loadā option, the data will be loaded onto your spreadsheet.
Get prepared for the role of a Business Analyst with the Post Graduate Program in Business Analysis. Enroll now!
Conclusion
In this write-up, we learned various approaches to delete duplicate records. Whether youāre interested in learning the basics of Excel, or want to develop more advanced Microsoft Excel skills, Simplilearn has a Business Analytics Certification Course with Excel for you. It is a very tedious task to remove duplicates in Excel, and we hope this article has helped you learn how to eliminate duplicates efficiently.
Please feel free to post any questions in the comments section of āHow to Remove Duplicates in Excel?: A Step-By-Step Guideā article. Our experts will get back to you on the same, at the earliest.