Using Data Validation to Prevent Duplicate Entries
Have you ever needed a method in Excel to prevent duplicate entries from being entered in a row or column? Of course you have! This tip will explain in detail how to use Data Validation to PREVENT duplicate entries from being entered. Excel has tools to identify and remove duplicate entries in data, but this method prevents them from even being entered.
First, let’s assume the range we want to prevent a duplicate entry is the range A1:A100.
1) Select the range A1:A100, starting from Cell A1. It is important to ensure the active cell is A1 by starting the selection with Cell A1 and then proceeding to the last cell in the range you want to protect.
2) Go to the Data Tab on the Ribbon, and then select Data Validation in the Data Tools group. When the dialog box opens, on the Settings Tab, select “Custom” in the “Allow:” box.
3) Then in the Formula box type the formula as show below:
=COUNTIF($A$1:$A$100,A1)=1

You can make adjustments to these procedures if your data is in a different column or starts in a row other than row 1. For example if your data is from E4 to E200, select the range E4:E200 starting from E4. Also you would need to adjust the formula as well.
4) You can also click the “Input Message” page tab and enter a message that the user will see each time they select any cell that has this Validation applied. However, this may be more of an annoyance than a benefit.
5) Finally, click the “Error Alert” page tab and set the level according to your needs and the list below.
Stop: No user will be allowed to enter data that already exists. They will be presented with the choice to either Retry or Cancel. Duplicate data entry is entirely prevented. This option allows you to enter a message to display when a duplicate entry is attempted.
Warning: The user will be provided a message that the entry is a duplicate and has to select either Yes, No, or Cancel. By selecting “Yes,” the user will be allowed to enter data that already exists. This option does not prevent the entry of duplicate data, but does warn the user they are about to enter duplicate data. The default button on the pop-up box is “No,” but the user can select “Yes” or “Cancel.”
Information: The user will be allowed to enter duplicates after confirming the entry by clicking “OK” on the message box which advises the user they are about to enter duplicate data. Again, this does not prevent the entry of duplicate data, but merely warns the user. The default button is the “OK” button and the user also has the choice of clicking “Cancel”.
Once you have decided which level of Alert you desire and entered an error message to display, if desired, you are done. Simply click OK and you are finished. Now you can test it by attempting to enter duplicate data in the selected range.
Now, it will be impossible to enter the same data twice in the range A1:A100, or at least without warning, depending upon the choices you made above. Note the Absolute Reference of $A$1:$A$100 and the Relative Reference of (A1) in the COUNTIF function formula. This is why step 1 requires you to begin with cell A1 when you select the range to apply the data validation, thus ensuring that Cell A1 becomes the active cell. The COUNTIF formula in the Data Validation for A2 will change automatically to:
=COUNTIF($A$1:$A$100,A2)>1
Note the $A$1:$A$100 never changes due to the use of Absolute on both the column (“A”) and the rows (1:100).