Custom formulas greatly extend the options for data validation. In other words, you can write your own formula to validate input.
#Gembox excel code
For example, you could require code that contains 5 digits.Ĭustom - validates user input using a custom formula. Text length - validates input based on number of characters or digits. For example, you can require a time between 9:00 AM and 5:00 PM, or only allow times after 12:00 PM. For example, you can require a date between Januand December 31 2021, or a date after June 1, 2018. Allowed values can be hardcoded directly into the Settings tab, or specified as a range on the worksheet.ĭate - only dates are allowed. The values are presented to the user as a dropdown menu control. List - only values from a predefined list are allowed. For example, with the Decimal option configured to allow values between 0 and 3, values like. For example, you can require a whole number between 1 and 10.ĭecimal - works like the whole number option, but allows decimal values. Once the whole number option is selected, other options become available to further limit input. Whole Number - only whole numbers are allowed. Note: if data validation was previously applied with a set Input Message, the message will still display when the cell is selected, even when Any Value is selected. When a data validation rule is created, there are eight options available to validate user input:Īny Value - no validation is performed. The Information alert window has 2 options: OK to accept invalid data, and Cancel to remove it. This message does nothing to stop invalid data. The Warning alert window has three options: Yes (to accept invalid data), No (to edit invalid data) and Cancel (to remove the invalid data). The warning does nothing to stop invalid data. The Stop alert window has two options: Retry and Cancel. Users can retry, but must enter a value that passes data validation.
Stops users from entering invalid data in a cell. The table below summarizes behavior for each error alert option. When style is set to Information or Warning, a different icon is displayed with a custom message, but the user can ignore the message and enter values that don't pass validation. For example, when style is set to "Stop", invalid data triggers a window with a message, and the input is not allowed. The Error Alert Tab controls how validation is enforced. The input message has no effect on what the user can enter - it simply displays a message to let the user know what is allowed or expected. If no input message is set, no message appears when a user selects a cell with data validation applied. This Input Message is completely optional. The Input Message tab defines a message to display when a cell with validation rules is selected. There are a number of built-in validation rules with various options, or you can select Custom, and use your own formula to validate input as seen below: The settings tab is where you enter validation criteria. Defining data validation rulesĭata validation is defined in a window with 3 tabs: Settings, Input Message, and Error Alert: Data validation is a good way to let users know what is allowed or expected, but it is not a foolproof way to guarantee input. If a user copies data from a cell without validation to a cell with data validation, the validation is destroyed (or replaced). It is important to understand that data validation can be easily defeated. Data validation controlsĭata validation is implemented via rules defined in Excel's user interface on the Data tab of the ribbon.
This can be a convenient way to give a user exactly the values that meet requirements. In addition, data validation can be used to present the user with a predefined choice in a dropdown menu: For example, if a product code fails validation, you can display a message like this: For example, you could use data validation to make sure a value is a number between 1 and 6, make sure a date occurs in the next 30 days, or make sure a text entry is less than 25 characters.ĭata validation can simply display a message to a user telling them what is allowed as shown below:ĭata validation can also stop invalid user input. Validation Formulas | Dependent Dropdown Lists | General Formulas Introductionĭata validation is a feature in Excel used to control what a user can enter into a cell.