Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Ensuring Unique Values in a Column.

Ensuring Unique Values in a Column

Written by Allen Wyatt (last updated September 14, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003


1

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. Choose Validation from the Data menu. Excel displays the Data Validation dialog box. (See Figure 1.)
  3. Figure 1. The Data Validation dialog box.

  4. Using the Allow drop-down list, choose the Custom option.
  5. In the Formula box, enter the following formula:
  6.      =MATCH(D1,$D:$D,0)=ROW(D1)
    
  7. 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

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2650) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Ensuring Unique Values in a Column.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Jumping Around Folders

If you need to move between two different folders quite regularly in the Open dialog box, you'll find the technique ...

Discover More

Unwanted Hyperlinks

Tired of having Excel convert what you type into active hyperlinks? Here are things you can do to undo Excel's ...

Discover More

Documenting Changes in VBA Code

Your company may be regulated by requirements that it document any changes to the macros in an Excel worksheet. Your ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (menu)

Specifying a Data Validation Error Message

Data validation is a great tool for limiting what can be input into a cell. Excel allows you to specify what should ...

Discover More

Limiting Input to a Format

When setting up a worksheet for others to use, you might want to make some limitations on what can be entered in certain ...

Discover More

Adding Pop-Up Documentation to a Cell

Want to have a small help screen pop up when a user selects a particular cell? This can be done by using data validation, ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 + 7?

2020-04-02 11:31:29

Nigel Horne

Give me a heck of a lot of false positives. Doesn't work.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.