How To Prevent Duplicate Data Entries

2016-12-23

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.

 

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

Subscribe

Advertisement

Related Articles

37 Awesome Excel Mouse Tips & Tricks You Should Know

37 Awesome Excel Mouse Tips & Tricks You Should Know

While the keyboard is generally quicker, you shouldn’t completely ignore the mouse. There are also some great time saving mouse shortcuts as well. In this post we’ll take a look at some of the best Excel mouse time saving tips and tricks.

read more
25 Amazing Power Query Tips and Tricks

25 Amazing Power Query Tips and Tricks

Power query is amazing tool that allows you to import and transform data with ease and helps to create repeatable and robust procedures with your data. Here are some tips and tricks to help you get the most out Power Query.

read more

Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get The Latest News

Follow Us

Follow us on social media to stay up to date with the latest tips in Excel!

Pin It on Pinterest

Share This