Home > Articles > Home & Office Computing > Microsoft Applications

  • Print
  • + Share This
This chapter is from the book

Using Data Validation to Limit Data Entry in a Cell

Data validation, found under Data, Data Tools, Data Validation, allows you to limit what a user can type in a cell. For example, you can limit users to whole numbers, dates, a list of selections, or a specific range of values. Custom input and error messages can be configured to guide the user entry.

The available validation criteria are as follows:

  • Any Value—The default value allowing unrestricted entry.
  • Whole Number—Requires a whole number be entered. You can select a comparison value (Between, Not Between, Equal To, and so on) and set the Minimum and Maximum value.
  • Decimal—Requires a decimal value be entered. You can select a comparison value (Between, Not Between, Equal To, and so on) and set the Minimum and Maximum value.
  • List—Requires user to select from a predefined list, as shown in Figure 3.22. The source can be within the Data Validation dialog box or can be a vertical or horizontal range on any sheet.
    Figure 3.22

    Figure 3.22. Provide users with a list of entries to choose from.

  • Date—Requires a date be entered. You can select a comparison value (Between, Not Between, Equal To, and so on) and set the Minimum and Maximum value.
  • Time—Requires a time be entered. You can select a comparison value (Between, Not Between, Equal To, and so on) and set the Minimum and Maximum value.
  • Text Length—Requires a text value be entered. You can select a comparison value (Between, Not Between, Equal To, and so on) and set the Minimum and Maximum number of characters.
  • Custom—Uses a formula to calculate TRUE for valid entries or FALSE for invalid entries.

Limiting User Entry to a Selection from a List

Data validation allows you to create a drop-down in a cell, restricting the user to selecting from a predefined list of values, as shown in Figure 3.22. To set up the source range and configure the data validation cell, follow these steps:

  1. Create a vertical or horizontal list of the values to appear in the drop-down. You can place these values in a sheet different from where the drop-down will actually be placed, then hide the sheet, preventing the user from changing the list.
  2. Select the cell you want the drop-down to appear in.
  3. Go to Data, Data Tools, Data Validation. The Data Validation dialog box opens.
  4. From the Allow field of the Settings tab, select List.
  5. Place your cursor in the Source field.
  6. Select the list you created in step 1, as shown in Figure 3.23. If your list is short, instead of the separate list you created in step 1, you can enter the values separated by commas directly in the Source field. For example, you could enter Yes, No in the source field (no quotes, no equal sign).
    Figure 3.23

    Figure 3.23. The source for the validation list can be a different sheet. You can then hide the sheet from users.

  7. If you want to provide the user with an input prompt, go to the Input Message tab and fill in the Title and Input Message fields.
  8. If you want to provide the user with an error message, go to the Error Alert tab and fill in the Style, Title, and Error Message fields.
  9. Click OK.
  • + Share This
  • 🔖 Save To Your Account