Skip to content

Data validation

Rules that limit what can be entered into cells: a dropdown list with coloured options, a checkbox, a number, a date, text, or a custom formula. Rules are set up in the Data validation side panel to the right of the sheet. The panel is opened by the list button on the toolbar (on a narrow screen, under More tools). How to choose values in cells with a list or a checkbox is described in Dropdown lists and checkboxes in cells.

  1. Select cells and click Data validation. A panel opens to the right of the sheet, and the button stays pressed. The sheet does not close: while the panel is open, you can select cells and enter values. The panel follows the active cell: click a cell with a rule, and the form shows its rule (the bin deletes exactly that one); click a cell without a rule, and the form is a new rule for it. An edit you have started is not reset: if you have already changed something in the form, typed a range by hand, or selected it with the mouse and moved to another field, a click on the sheet does not change the form. If the rule changed on the sheet (by dragging, pasting or undo) and you have not touched the form, the form shows its current state.
  2. While the sheet has no rules, the panel shows the form for a new rule straight away, without a list. After the first rule is saved, the list of the sheet’s Rules and the button Add rule appear at the top. A row of the list shows how the rule looks in a cell: the coloured options (the first six) or the validation type, with the ranges under them. A rule from the list opens in the form, and its first range is selected on the sheet.
  3. Ranges: the cursor is already in this field. For a new rule, the field listens to the sheet straight away: outline the cells with the mouse, and the address is entered by itself. For a saved rule, the field starts listening to the sheet only when you click in it or start typing. A new area replaces all the text in the field. While the field waits for a selection, it has a coloured frame. The field stops listening to the sheet when you move to another field of the panel, or press Escape or Enter in it (Enter also saves the rule). To enter several ranges, separate them with commas, for example A1:A20, C1:C20.
  4. Validation type: List, Checkbox, Number, Date, Text or Custom formula.
    • List: fill in Options. For each option, set the colour, and use the buttons Move up, Move down and Delete option. A new option is added with the Option button. The Multiple values checkbox allows choosing several values. Display: Chips, Arrow or Text. In Text there is no arrow; the list opens by clicking the value or pressing Enter.
    • Checkbox: by default it stores TRUE/FALSE. Use custom values instead of TRUE/FALSE sets what is written into the cell when it is ticked (Checked) and when it is unticked (Unchecked).
    • Number: between, not between, greater than, greater than or equal to, less than, less than or equal to, equal to, not equal to.
    • Date: valid date, before, after, on, between, not between.
    • Text: contains, does not contain, email address, website address, length no more than, length between.
    • Custom formula: a condition such as =A1>0, evaluated relative to the first cell of the range.
  5. On invalid input: Reject means the wrong value is not saved. Allow means it is saved, but the text of the cell is underlined with a wavy line.
  6. Help text when selecting a cell: a short text that appears next to the selected cell.
  7. Click Save: the panel stays open, and the rule is selected in the list. Delete (the bin at the bottom of the panel, only for a saved rule) removes the whole rule, with all its ranges, and the form is ready for a new one. To remove validation from only some of the cells, use Remove data validation in the cell menu (part two). Cancel returns the form to the rule of the active cell, or to a new rule for the selection.
  8. To close the panel, click Close in its header, press Escape, or click Data validation once more. While the Ranges field is listening to the sheet, the first Escape only stops the listening, and the second closes the panel. The width of the panel can be changed by dragging its left edge. If you switch to another sheet, the form starts over from that sheet’s selection.
  9. Only one workbook panel is open on the right at a time. If you open Comments, Conditional formatting, Agent or another panel, Data validation closes, and vice versa (for details, see Spreadsheets (workbooks)).
  • Only those who can edit the spreadsheet can create and change rules.
  • A sheet can have up to 1000 rules. A rule can have up to 100 ranges. Ranges do not overlap, neither within a rule nor with other rules.
  • Identical lists and checkboxes — with the same settings, help text, option names and colours — are one rule: dragging and pasting extend it instead of making a copy. Beyond 100 ranges, the rest goes into the next identical rule. Number, date, text and custom formula validations are not merged.
  • A list can have up to 500 options, each up to 500 characters, without duplicates.
  • The help text can be up to 500 characters. The condition value for a number or a date can be up to 200 characters, and for text up to 500.
  • A rule does not erase what is already in the cells: values that do not fit remain visible.
  • On a summary sheet, in a version view and in a spreadsheet opened for viewing only, there is no panel. An open panel closes when you go there, and does not come back by itself.
  • On a phone, the panel stands under the sheet at full width and takes up to 45% of the screen height; the Rules list takes up to 20%. The list and the fields scroll together, and Save is always visible at the bottom. Selecting cells on a phone is awkward, so type the address instead, for example A1:A20.
What you see on the screen Why What to do
Check the ranges A range is written incorrectly, or goes beyond the sheet Fix it, for example A1:A20
Check the options An empty or duplicate option Fill in the option, or delete the extra one
Fill in the condition value, or Enter both condition values The numbers or dates for the condition are missing Enter the values
Enter a condition formula Custom formula is selected, and the field is empty Enter the formula
The “checked” and “unchecked” values must differ Both checkbox values are the same Set different values
Check the rule The rule did not pass the check as a whole (for example, its ranges overlap each other) Check the ranges and the condition
Range belongs to another rule The range overlaps the cells of another rule Narrow the range, or remove validation from those cells
When typing: Choose a value from the list, Number from 1 to 10, Enter a date, and so on (in the interface language; the limits are as the rule’s author wrote them) The value does not pass a rule set to Reject Enter a suitable value, or change On invalid input to Allow
The text in the cell is underlined with a wavy line The value does not pass a rule set to Allow Correct the value, if needed
The address in Ranges does not change when you select cells For a saved rule, the field is not listening to the sheet yet, or it stopped listening: you moved to another field, or pressed Escape or Enter in it Click the field and outline the cells
A click on a cell did not open its rule An edit of another rule has started in the form Save it or click Cancel
The panel closed by itself Another workbook panel opened, you moved to a summary sheet, or you opened a version from the history Click Data validation again