Today I’ll tell you how to prevent duplicates from appearing in a column of your Excel worksheet. This tip works in Microsoft Excel 2013, 2010, 2007 and lower.
We covered a similar topic in one of our previous articles. So you should know how to automatically highlight duplicates in Excel once something has been typed.
This article will help you stop duplicates appearing in one or several columns in your Excel worksheet. So you can have only unique data in the 1st column of your table be there invoice numbers, stock keeping units, or dates, each mentioned only once.
Get 20+ smart tools for Excel to automate your daily tasks
Try our Ultimate Suite for Excel.
Special offer only for our blog readers and only until next Friday!
Click to get a license of Ultimate Suite and save $45 off the regular price!
How to stop duplication – 5 easy steps
Excel has Data Validation – one unfairly forgotten tool. With its help you can avoid errors occurring in your records. We will be sure to devote some future articles to this helpful feature. And now, as a warm-up, you will see a simple example of using this option.
Suppose, you have a worksheet named “Customers” that includes such columns as Names, Phone numbers, and Emails you use for sending newsletters. Thus all email addresses must be unique. Follow the steps below to avoid sending the same message to one client twice.
0. If necessary, find and delete all duplicates from the table. You can first highlight the dupes and delete them manually after looking through the values. Or you can remove all duplicates with the help of the Duplicate Remover add-in.
1. Select the entire column where you need to avoid duplicates. Click on the first cell with data keeping the Shift keyboard button pressed and then select the last cell. Or simply use the combination of Ctrl + Shift + End. It is important to select the 1st data cell first.
2. Go to Excel “Data” tab and click on the Data Validation icon to open the dialog box.
3. On the Settings tab, choose “Custom” from the Allow drop down list and enter =COUNTIF($D:$D,D2)=1 into the Formula box.
Here $D:$D are the addresses of the first and the last cells in your column. Please pay attention to the dollar signs that are used to indicate absolute reference. D2 is the address of the first selected cell, it is not an absolute reference.
With the help of this formula Excel counts the number of occurrences of the D2 value in the range D1:D1048576. If it is mentioned just once, then everything is fine. When the same value appears several times, Excel will show an alert message with the text you specify on the “Error alert” tab.
you don’t won’t to work with any longer. I will give more details about this Data Validation option in one of my future posts.
4. Switch to the “Error alert” tab, and enter your text into the fields Title and Error message. Excel will show you this text as soon as you try to enter a duplicate entry into the column. Try to type the details that will be accurate and clear for you or your colleagues. Otherwise, in a month or so you can forget what it means.
Title: “Duplicate email entry”
Message: “You have entered an email address that already exists in this column. Only unique emails are allowed.”
5. Click OK to close the “Data validation” dialog.
Now when you try to paste an address that already exists in the column, you will see an error message with your text. The rule will work both if you enter a new address into an empty cell for a new customer and if you try to replace an email for the existing client:
If your “No duplicates allowed” rule can have exceptions
On the fourth step choose Warning or Information from the Style menu list. The alert message behavior will change correspondingly:
Warning: The buttons on the dialog will turn as Yes / No / Cancel. If you click Yes, the value you enter will be added. Press No or Cancel to get back to editing the cell. No is the default button.
Information: The buttons on the alert message will be Ok and Cancel. If you click Ok (the default one), a duplicate will be added. Cancel will take you back to the editing mode.