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

Tips.Net > ExcelTips Home > Data Entry > Data Validation > Limiting Entry of Names

Limiting Entry of Names

Summary: When setting up a worksheet for data entry purposes, you may want to limit what can be entered in a cell. This tip explains how you can make sure that someone cannot enter into a cell something that was previously entered in the same column. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, and Excel 2003.)

Using Excel for entering data is quite common. When you are entering information, you may want to limit what can be placed in a particular cell. For instance, you might be working on an employee register, and you need to make sure that you only enter each employee's name a single time in the worksheet.

One way to approach this challenge is to create a list of allowable names, either on another worksheet or in a different place on the same worksheet. Give this list of names a defined name, such as ValidNames. Then, follow these steps:

  1. Choose the cells where you will be entering employee names; the ones where you want to make sure you only enter each name once. (For this example, let's assume you select cells A1:A10.)
  2. Choose the Validation option from the Data menu. Excel displays the Data Validation dialog box.
  3. Make sure the Settings tab is displayed. (Click here to see a related figure.)
  4. In Allow drop-down list, choose Custom.
  5. In the Formula box (which appears when you complete step 4), enter the following formula:
     =AND(COUNTIF(ValidNames,A1)=1,COUNTIF($A$1:$A$10,A1)=1)
  • Click OK to close the dialog box.
  • This validation formula works because it checks the input range (A1:A10) and makes sure that no more than one name from the ValidNames list appears there. There are many other variations on this particular formula that can be used, since Excel does provide many different ways to accomplish the same task. An example of an alternate formula method is provided in the Microsoft Knowledge Base:

    http://support.microsoft.com/?kbid=213185
    

    These formulaic methods work great if you are typing names into your input list. If you instead prefer to use a drop-down list to select names, there is a slick method presented at this Web page:

    http://www.contextures.com/xlDataVal03.html
    

    What makes it slick is that the drop-down list is dynamic. For instance, when you select a name to go into one cell, that name is removed from the drop-down list used to select names in other cells. Quite nice.

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


    Don't Go in Debt for Christmas! Tired of trying to keep up with the Joneses for Christmas? Want to enjoy the season rather than dread the aftermath? Learn how you can avoid the financial traps that spring up every Christmas.
     
    Check out Top Fifteen Tips for Financing Christmas today!

    Helpful Links

    Ask an Excel Question
    Make a Comment

    Tips.Net Home

    ExcelTips FAQ
    ExcelTips Premium

    Learn Access Now

    Beauty Tips
    Car Tips
    Cleaning Tips
    College Tips
    Cooking Tips
    Excel2007 Tips
    ExcelTips
    Family Tips
    Gardening Tips
    Health Tips
    Home Tips
    Money Tips
    Organizing Tips
    Pest 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.)