Validating Cell Contents
- Introduction
- Entering Data Using the Keyboard
- Speeding up Data Entry
- Sharing Content between Sheets
- Validating Cell Contents
- Editing Data
- Formatting Data
- Autoformatting Cells and Sheets
- Formatting Spreadsheets Using Themes
- Using Conditional Formatting
- Hiding and Showing Data
- Finding and Replacing in Calc
Validating Cell Contents
When creating spreadsheets for other people to use, you may want to make sure they enter data that is valid or appropriate for the cell. You can also use validation in your own work as a guide to entering data that is either complex or rarely used.
Fill series and selection lists can handle some types of data but are limited to predefined information. To validate new data entered by a user, select a cell and use Data → Validity to define the type of contents that can be entered in the cell. For example, a cell might require a date or a whole number, with no alphabetic characters or decimal points, or a cell can be defined so that it cannot be left empty.
Depending on how validation is set up, the tool can also define the range of values that can be entered and provide help messages that:
- explain the content rules you have set up for the cell
- explain what users should do when they enter invalid content.
You can also set the cell to refuse invalid content, accept it with a warning, or—if you are especially well-organized—start a macro when an error is entered. Validation is most useful for cells containing functions. If cells are set to accept invalid content with a warning, rather than refusing it, you can use Tools → Detective → Mark Invalid Data to find the cells with invalid data. The Detective function marks any cells containing invalid data with a circle.
Note that a validity rule is considered part of a cell’s format. If you select Format or Delete All from the Delete Contents window, the rule is removed. To copy a validity rule with the rest of the cell, use Edit → Paste Special → Paste Formats or Edit → Paste Special → Paste All.
Figure 41 shows the choices for a typical validity test. Note the Allow blank cells option under the Allow list.
Validity test options vary with the type of data selected from the Allow list. For example, Figure 42 shows the choices when a cell must contain a value from a cell range.
To provide input help for a cell, use the Input Help tab of the Validity dialog (Figure 43). To show an error message when an invalid value is entered, use the Error Alert tab (Figure 44). Be sure to write a helpful explanation of what a valid entry should contain. Provide more than just a simple “invalid data—try again” message. To be of real help to users, particularly inexperienced ones, error messages need to provide details not only on what went wrong but also on how to correct it.
| Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY). |