Excel Tutorial

Excel Tutorial Shortcut Keys in Excel Formatting in Excel Notes in Excel Formats in Excel Cells and Ranges in Excel Excel Function and Formulas Conditional Formatting in Excel Data Validation in Excel Charts in Excel Excel Ribbon Toolbar Basics of Excel Spell Check in Excel Data Analysis in Excel AutoFill in Excel Goal Seek in Excel Solver in Excel Pivots Table in Excel Go-To Special function in Excel Blank cells in Excel Count Cells with Text in Excel Date and Time in Excel-VBA Dependent Drop-down List in Excel Operators in Excel Dependent Combo box in Excel VBA Error Bar in Microsoft Excel Excel Axes Excel File using Password Excel Unique Values Frequency Distribution in Excel Gauge Chart in Excel Histogram in Excel Sum Every Nth Row in Microsoft Excel SumIF Formula in Microsoft Excel Multiplication in Excel Unique Values in Excel Trendline in Excel Excel Themes Copying formula in Excel Check Marks in Excel Calculating the Last Day of the Month in Excel Calculating Age in Excel Insert Row in Excel

Functions

Excel MAX() Function Excel INT() Function Excel MOD() Function Excel ROUND() Function Excel ROUNDUP() Function Excel AVERAGE() Function Excel COUNT() Function Excel COUNTA() Function Excel COUNTBLANK() Function Excel MIN() Function Excel EDATE() Function Excel EOMONTH() Function Excel HOUR() Function Excel MINUTE() Function Excel SECOND() Function Excel TIME() Function Excel WORKDAY() Function Excel WORKDAY.INTL() Function Excel DAYS() Function Excel WEEKNUM() Function Excel WEEKDAY() Function Excel SMALL() Function Excel LARGE() Function Excel LEFT() Function Excel RIGHT() Function Excel MID() Function Excel FIND() Function Excel SEARCH() Function Excel EXACT() Function Excel SUBSTITUTE() Function Excel TEXT() Function Excel VALUE() Function Excel AND() Function Excel OR() Function Excel IFERROR() Function Excel IF() Function Excel Nested IF’s Function Excel IFNA() Function Excel COUNTIFS() Function Excel VLOOKUP() Function Excel HLOOKUP() Function Excel INDEX() Function Excel MATCH() Function Excel OFFSET () Function Averageif Function in Excel

How To

How to import Microsoft Access data into the Microsoft Excel How to use TODAY function in Excel How to Alphabetize in Excel How to remove duplicate values from excel How to lock cells in Excel How to create drop down in excel How to Delete Row in Microsoft Excel How to Highlight Duplicates Words in the Microsoft Excel How to print titles in Excel How to make use of the Wildcard in Excel How to Make Use of the F-Test in Excel How to make use of the Excel Autofit in Excel How to generate random numbers in Excel How to apply Advanced Filter in Excel How to use Index and Match in Excel

Misc

Absolute Value in Excel Adding Column in Excel Converting Units in Excel Count Characters in Excel Custom Sort Order in Excel Decimals in Excel Division in Excel Locate Maximum Values in Excel Nearest Multiple in Excel Paste Options in Excel Quarter Dates in Excel Row Difference in Excel Separate Strings in Excel Reverse List in Excel Array Formula in Excel What if Analysis Data Table in Excel Excel Shortcut Keys What is a spreadsheet in Excel?

How to remove duplicate values from excel?

Remove duplicate values from excel

Duplicate values occur when the same date or set of values is repeated in your Excel sheet. While working with Excel sheets many a time, the user mistakenly copies data or rows. Duplicate values happen to be a problem that can lead to errors; thus, degrading the result. This can be a very monotonous, time-consuming, and repetitive task, but Microsoft Excel provides different tricks to make the duplicates elimination process simpler.

Remove Duplicate Values

Excel provides an inbuilt feature to find and remove the duplicate value. Execute the below steps for identifying and deleting values in Excel:

  1. Select your data in Excel or directly press the shortcut keyword CTRL + A.
remove duplicate values from excel
  • In the Excel Ribbon tab, select data tab-> Data Tools -> Remove duplicates
remove duplicate values from excel
  • The Remove Duplicates dialog box appears. The first row is deselected by default. You can select it by unchecking the ‘My data has headers’ option. The next step is to check all the ‘Columns’ options and click on OK.
remove duplicate values from excel
  • A prompt will pop up, displaying the figures of duplicate values found and removed and the remaining unique values.
remove duplicate values from excel
  • Excel will remove all the duplicate values. The identical value that indexes first will be kept, and rest all the duplicated will be removed. In the below image, we have compared both the data for your reference.
remove duplicate values from excel

Excel Advanced Filtering Method

The second way to get rid of the duplicate values is by using the Advanced Filtering method. This method was added to the Microsoft Excel version 2003. It is a handy method of eliminating duplicate data and, at the same time, creating a copy of the Excel data. But advanced filters will only be able to perform this on the entire table. Let’s learn the step by step process for executing this method:

  1. The first step is to select your data in Excel or directly press the shortcut keyword CTRL + A.
remove duplicate values from excel
  • From the Excel ribbon toolbar, select Date-> Sort & Filter -> Advanced.
remove duplicate values from excel
  • The Advanced Filter window will pop up. The ‘Action’ comprises two values, i.e., filter and copy. Here we have selected the filter option. If you want, you can either choose the Copy action to replicate the source data to another location. Filtering the data list will hide rows containing any duplicates while copying to another location will create a copy of the data.
remove duplicate values from excel
  • By default, the listed range is automatically filled by Excel (as per the selected cells). But still, the user can adjust the listed range as per his requirements. Although it contains the first row in the listed range, but this method atomically detects the first row for headers. You have to remove the duplicated from the first row manually.
remove duplicate values from excel
  • The Criteria range is optional can be left blank. This option is used to set any chosen criteria for a specific cell range. The ‘Copy to’ field option is filled to allocate the space where the data will be stored. But as we have not selected the ‘Copy action’ so here it is omitted.
remove duplicate values from excel
  • Check the box for Unique records only. It will remove all the duplicate value and will only restore the unique data. Click on OK.
remove duplicate values from excel
  • All the duplicate values have been eliminated from the Excel sheet. You will notice the row number containing the duplicate data has also been removed.
remove duplicate values from excel

Removing Duplicates Using a Formula

Microsoft also provides an alternative formula method to help you find and remove duplicate values from your Excel data. To use this method, an additional helper column is added that combines all the data from different columns. Let’s check the steps to execute the formula method:

  1. The first step is to add a new column wherein we will combine the data from all the columns, and based on the combined details we will define the duplicate values. There are two formula

 a.) to directly concatenate all the columns into a single column by using the ampersand operator

Formula used: = [@id] & [@email] & [@full_name] & [@Sales] & [@Month]

b.) The above formula becomes length for a long list of columns. The TEXTJOIN formula can be used as an alternate to concatenate the column’s data.

Formula used: =TEXTJOIN("",FALSE,Col1:ColN)

In the below data we have used the TEXTJOIN formula.

remove duplicate values from excel
  • Now, we will add another column to count the number of times the similar values appear in the Excel data. We will use the COUNTIF function.

Formula Used: = COUNTIFS($G$2:G2, G2)

remove duplicate values from excel

Explanation for the Formula: The COUNTIFS formula will calculate the count of the data. If the count is equal to 1, it signifies that the data is unique, but if the count is equal to 2 or more, it signifies that it is a duplicate value and has to be removed.

  • The third step is to add filters to your Excel data. Under Excel ribbon tab select Data tab -> Sort & Filter-> Filter command or you can directly use the keyword shortcut CTRL + SHIFT + L.
remove duplicate values from excel
  • The filter icon will appear on the top of the headers. You can click on it and select 1. Filtering on 1 will segregate all the unique values and will hide all duplicates values.
remove duplicate values from excel
  • Select the unique data (directly use keyboard shortcut Alt + ;) and paste anywhere in your workbook. 
remove duplicate values from excel

Removing Duplicates using VBA.

Life will be easier if the duplicate excel values are deleted with a click of a button. There is a pre-defined command in VBA for removing duplicate values within your excel data. Follow the below steps to execute your below code.

  1. Start your code with Sub procedure and declare your code name.

Program:

Sub VBA_Method_RemoveDuplicates()
 End Sub 
remove duplicate values from excel
  • Declare the range variable and specify the excel data range.

Program:

Sub VBA_Method_RemoveDuplicates()
     Dim DupliValues As Range
     'setting the range of the Excel data
     Set DupliValues = Range("A1: F17")
 End Sub 
remove duplicate values from excel
  • Now, we will use the RemoveDuplicates method. It has two parameters, i.e., Column (wherein we will specify the column to remove duplicates) and Header (it specifies whether the list has header values or not and takes two values xlYes and xlNo).

Program:

Sub VBA_Method_RemoveDuplicates()
     Dim DupliValues As Range
     'setting the range of the Excel data
     Set DupliValues = Range("A1: F17")
     DupliValues.RemoveDuplicates Columns:=Array(1, 4), Header:=xlYes
 End Sub 
remove duplicate values from excel

Output:

remove duplicate values from excel