
The value of an empty cell is treated like any other value. Empty cells are not ignored by removeDuplicates.If two different functions evaluate to the same result, the cell values are not considered duplicates. removeDuplicates considers cell values, not function results.When using a range's removeDuplicates method, keep the following in mind. The removeDuplicates method returns a RemoveDuplicatesResult object that specifies the number of rows removed and the number of unique rows remaining. When true, the top row is ignored when considering duplicates. The method also takes in a boolean parameter that specifies whether the first row is a header. This array is zero-based and relative to the range, not the worksheet. RemoveDuplicates takes in a number representing the column indices which are checked for duplicates. removeDuplicates does not affect the position of cells outside of the range. Rows in the range below the deleted row are shifted up. A row is deleted if a value in its specified column or columns appeared earlier in the range. The method goes through each row in the range from the lowest-valued index to the highest-valued index in the range (from top to bottom). The Range.removeDuplicates method removes rows with duplicate entries in the specified columns. For the complete list of properties and methods that the Range object supports, see Excel.Range class.
#Delete duplicates in excel code
This article provides a code sample that removes duplicate entries in a range using the Excel JavaScript API. If you later decide to remove it again, it’s a simple case of right clicking on it and selecting Remove from Quick Access Toolbar.Remove duplicates using the Excel JavaScript API Now the command will appear in the Quick Access Toolbar (in top left hand corner of the screen). Right click on the Remove Duplicates command and select Add to Quick Access Toolbar. If you tend to do a lot of removing duplicates, why not add the command to the Quick Access Toolbar? That way you won’t have to jump to the Data tab every tim you want to use it. In our simple spreadsheet, Excel rightly selects Column A.Ĭlick OK and a confirmation dialogue informs us that 4 duplicate values were found and removed (18 unique values remain). The Remove Duplicates window opens and allows you to confirm the column that you will perform the operation on. Open that in Excel and then click the Remove Duplicates button. Here is a sample spreadsheet with ingredients in it. That very command is found on the Data tab in the Data Tools group. The hardest part is finding the command to do it! In your spreadsheet, many ingredients may be duplicated several times. Garlic is an ingredient in spaghetti bolognese, chicken and ginger, and so on. Imagine, for example, that you are writing a shopping list and are copying and pasting ingredients from several recipes into an excel spreadsheet. The ability to remove duplicate entries from a list is a useful one, and one that can be used in a variety of every day situations.
