Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Ensuring Unique Values in a Column.
by Allen Wyatt
(last updated March 28, 2015)
When you are entering information in a worksheet, you may want to ensure that the data being entered is actually unique for a particular column. For instance, if you are entering a series of invoice numbers in column D of a worksheet, you may want to ensure that you don't enter the same invoice number twice.
There are a couple of ways that you can approach such a problem. If you are always entering your new information at the bottom of a column, you can use Excel's data validation feature to make sure that whatever you are entering in the current cell does not match anything higher up in the column. Simply follow these steps:
Figure 1. The Data Validation dialog box.
If you may be entering data anyplace within column D, and you want to know if you are entering a value that is elsewhere in the column (above or below the current cell), then you can follow the above steps, but use this formula in step 5:
There is one other thing to keep in mind: All bets are off if a user copies a value into a cell in the column. This results in the data validation information be overwritten as the copy is completed. If such a thing is likely to happen with your data, the only way around it is to create a macro that checks, after each action, whether the data validation has been removed from cells where it should be present. Such is not a trivial undertaking.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10673) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Ensuring Unique Values in a Column.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
Data validation is a great tool for limiting what can be input into a cell. Excel allows you to specify what should appear on ...Discover More
Want to control what users put into a cell? It's easy to do using a feature called data validation, as described in this tip.Discover More
When using data validation, you may want to reference a list of validation criteria contained on a different worksheet. ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.