XL2000: How to Use Data Validation to Prevent Duplicate Entries (213185)



The information in this article applies to:

  • Microsoft Excel 2000

This article was previously published under Q213185

SUMMARY

This article explains how to use data validation to prevent the creation of duplicate entries in a list.

MORE INFORMATION

The following example uses data validation to prevent duplicate entries from being entered within the range of cells A1 through A50. To create the example, you need set up two validation rules: one for the first cell in the list, and one for the rest of the cells. To do so, follow these steps:
  1. Save and close any open workbooks, and then create a new workbook.
  2. Select cell A1 and click Validation on the Data menu.
  3. In the Allow list, click Custom, and then type the following formula in the Formula box:

    =ISERROR(MATCH(A1,A2:A50,0))

  4. Click the Error Alert tab, type the error message title that you want the user to see in the Title box, and then type the error message that you want the user to see in the Error Message box.
  5. In the Style list, click Stop, and then click OK to apply the validation rule to cell A1.
  6. Select cells A2:A50, and then, on the Data menu, click Validation.
  7. On the Settings tab, click Custom in the Allow list, and then type the following formula in the Formula box:

    =ISERROR(MATCH(A2,INDIRECT("$A$1:$A$"&ROW()-1),0))

  8. Click the Error Alert tab. In the Title box, type the error message title that you want the user to see, and then in the Error Message box, type the error message that you want the user to see.
  9. In the Style list, click Stop, and then click OK to apply the validation rule to cells A2:A50.
As you make entries into cells A1:A50, Excel applies the validation rules that you have established. If you make a duplicate entry, you receive an error message. Clicking Retry allows you to change the cell entry, and clicking Cancel removes the cell entry.

REFERENCES

For additional information about data validation, click the article number below to view the article in the Microsoft Knowledge Base:

211485 XL2000: Description and Examples of Data Validation

For more information about data validation, click Microsoft Excel Help on the Help menu, type troubleshoot data validation in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbdtacode kbhowto kbinfo KB213185