Prevent Duplicate Data Entry using Cell Validations

Share

Facebook
Twitter
LinkedIn

We all know that data validation is a very useful feature in Excel. You can use data validation to create a drop-down list in a cell and limit the values user can enter. But, do you know that you can use data validation in a multitude of ways to prevent users from entering wrong data?

Here is a practical application: Prevent users from entering duplicate values in a range of cells.

For eg. you are making an invoice. Wouldn’t it be cool if Excel prompted you when you enter a duplicate line item so that increase the item quantity instead of repeating it.

Here is a 3 step tutorial to do just that.

Step 1: Identify the range of cells where you want only unique values to be entered

This is simple. All you have to do is find the range where you want to control the user input. Lets say the range is B4:B11

Step 2: Set up Data Validation to prevent duplicate entries

Select the range (B4:B11) and go to data validation (Excel 2007: Data Ribbon > Data Validation, or press ALT+AVV)

Using Data Validation to prevent DuplicatesNow, specify the validation type as “Custom”, this will allow us to use formulas to check for valid data. In our case, we need check if a particular entry is duplicated in the range B4:B11. This can be easily done using COUNTIF formula [learn COUNTIF Formula in plain English].

Go to the formula field and type the countif formula like this: =COUNTIF($B$4:$B$11,B4)<=1

Also, you can set up the “Error Alert” so that you can show a custom message when a duplicate value is typed, like “You have already added that product” message.

Data Validation - Error message

Once you set up error message, it will show up like this:

Data validation to prevent duplicates - error message example
Step 3: Sit back and Relax

The third step is all too familiar. Now that you have prevented duplicate entries in your spreadsheets you can sit back and relax. May be read a few more spreadcheats.

More kickass stuff on data validation (and working with duplicates) using excel

There are a ton of useful articles on the site related to data validation and working with duplicates using excel. Here is a sample. Get started and learn something useful today.

This post is part of our spreadcheats series (yes, the series is still going after one year 😛 )

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

Leave a Reply