Get The Completed Workbook


Suppose we have some data for an employee list that will continually be updated and we want to make sure that any user adding to the list doesn’t add a duplicate entry. In this post we’ll learn how to use data validation to prevent a user from entering a value if it’s already been entered in the table.


In our example we have a simple set of data that contains a field for employee ID, name and address and we will prevent any duplicated employee ID’s being entered. Our data has also been turned into a table and the table has been named EmployeeData. If you want to read how to create a table in Excel, please read thisĀ Introduction To Excel Tables.


Step-001-How-To-Prevent-Duplicate-Data-Entries-1024x559 How To Prevent Duplicate Data Entries


Add a custom validation criteria. This will allow us to write a formula to test whether the data is valid or not. In this case we will enter a formula to count how many times the value appears in the list and limit it to 1.

  1. Select the full column of data which we’re going to limit to unique values.
  2. Go to the Data tab.
  3. Press the Data Validation button.
  4. Select Data Validation from the drop down menu.
  5. Select the Settings tab.
  6. In the Allow drop down select Custom.
  7. In the Formula area input this formula.
    =(COUNTIFS(INDIRECT("EmployeeData[Employee ID]"),A2)=1)


Step-002-How-To-Prevent-Duplicate-Data-Entries-1024x543 How To Prevent Duplicate Data Entries


We can also add a warning message to users that will display when the active cell cursor is on a cell with this data validation.

  1. Go to the Input Message tab.
  2. Enter a Title for the input message.
  3. Enter a descriptive message that will warn the user about the data validation for unique values.
  4. When the active cell is in the range with this unique value data validation, the input message will display.


Step-003-How-To-Prevent-Duplicate-Data-Entries-1024x515 How To Prevent Duplicate Data Entries


We can also add a error message that will display if the user does try to input a duplicate value.

  1. Go to the Error Alert tab.
  2. Select the style of pop up message, either Stop, Warning or Information.
  3. Enter a Title for the pop up message.
  4. Enter a descriptive message that will warn the user about their error.
  5. Press the OK button.
  6. Now if you try to enter a duplicate value, a pop up message box will alert you about your error of entering a duplicate value.