bottom
Great ExcelTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > ExcelTips Home > Data Entry > Data Validation > Ensuring Unique Values in a Column

Ensuring Unique Values in a Column

Summary: If you want to make sure that only unique values are entered in a particular column, you can use the data validation capabilities of Excel to your advantage. It’s easier than you think, as this tip shows. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)

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:

  1. Select column D.
  2. Display the Data Validation dialog box. (In versions of Excel prior to Excel 2007, choose Data | Validation. In Excel 2007 click the Data tab of the ribbon and then click Data Validation in the Data Tools group.)
  3. Using the Allow drop-down list, choose the Custom option.
  4. In the Formula box, enter the following formula:
  5.      =MATCH(D1,$D:$D,0)=ROW(D1)
    
  6. Click on OK.

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 4:

=COUNTIF($D:$D,D1)<2

Tip #2650 applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007


Save Time! ExcelTips has been published weekly since late 1998. Past issues of ExcelTips are available in convenient ExcelTips archives. Have your own enhanced archive of ExcelTips at your fingertips, available to use at any time!
 
Check out ExcelTips Archives today!

Helpful Links

Ask an Excel Question
Make a Comment

Tips.Net Home
Vital News Home

ExcelTips FAQ
ExcelTips Premium

Learn Access Now

Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

 

Great Info!

Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)