Confident CellsExcel practice Start free

Data validation: drop-down lists, limits and messages: practice exercises

Data Validation, List, Whole number, Date, Text length, Input Message, Error Alert, Circle Invalid Data. 8 exercises on real-looking data, each checked as you go. The full lesson is part of Pro.

In the lesson

This lesson has Excel's Data Validation box, with its Settings, Input Message and Error Alert tabs, above a practice sheet: set drop-down lists and limits as you would in Excel, and each task is checked as you go.

Open the Data validation: drop-down lists, limits and messages lesson

How it works

Data validation sets what can go in a cell: a choice from a drop-down list, a whole number from 0 to 40, a date after a given day, or text no longer than 10 characters. Type something else and Excel says no.

You'll make drop-down lists from typed items and from cells, set limits, add a message that shows when the cell is clicked, choose how strict the error is, and find values that were there before the rule.

A drop-down list

A column says whether each person has paid. People type yes, Y, paid… and COUNTIF can't count them. A drop-down list with just Yes and No stops that.

Select the cells (C2:C11), then Data, Data Validation…. On the Settings tab set Allow to List and type the items in Source with commas: Yes,No. Keep In-cell dropdown ticked. Click a cell and a ▾ appears beside it; Alt+↓ opens it from the keyboard.

If the items are already in cells, select them for the Source instead: =$E$2:$E$5. Then the list changes when those cells do.

Windows: Data, Data Tools, Data Validation.

Mac: Data, Data Validation (or the Data menu at the top, Validation…).

Limits: numbers, dates and lengths

Allow sets the kind of entry, and Data the comparison:

  • Whole number between 0 and 40: 37 is fine, 37.5 and 41 aren't. Decimal lets in 37.5.
  • Date greater than or equal to 01/01/2027: only that date or later. A formula works too, such as =TODAY().
  • Time, such as between 09:00 and 17:30.
  • Text length less than or equal to 10: a code of up to 10 characters.
  • Custom: a formula that must be TRUE, such as =COUNTIF($A$2:$A$20,A2)=1 for no repeats.

Ignore blank (ticked) lets a cell be left empty.

Input message and error alert

The Input Message tab sets a note that shows when the cell is selected, before anything is typed: a title (Discount) and a message (Type 0.1 for 10%.).

The Error Alert tab sets what happens when a wrong value is typed. The Style decides how strict it is:

  • Stop: the value can't be kept. Retry or Cancel.
  • Warning: “Continue?” Yes keeps it, No lets you change it.
  • Information: OK keeps it.

Give a title and message of your own, or Excel shows its own: This value doesn't match the data validation restrictions defined for this cell.

Values from before the rule

A rule only checks what's typed after it's set. Values already in the cells, or pasted in, aren't checked.

To find them, choose Data, Data Validation ▾, Circle Invalid Data: each value that breaks its rule gets a red circle. Fix it and the circle goes. Clear Validation Circles takes them all away.

To remove a rule, select the cells, open Data Validation and press Clear All.

Windows: Data, Data Validation ▾, Circle Invalid Data.

Mac: Data, Data Validation ▾ (the arrow beside the button), Circle Invalid Data.

Data validation rules at a glance

Every rule is set in the same box: select the cells, then Data › Data Validation, on Windows and on a Mac. Allow picks the kind of rule. This is what each one lets in and turns away.

AllowSettingsLet inTurned away
ListSource: Yes,NoYes, NoMaybe, Y
Whole numberbetween 0 and 400, 37, 4037.5, 41, -1
Decimalbetween 0 and 10.1, 0.25, 11.5, 10
Dategreater than or equal to 01/01/202701/01/2027, 30/06/202831/12/2026
Timebetween 09:00 and 17:3009:00, 13:1508:45, 18:00
Text lengthless than or equal to 10AB-1234 (7 characters)ABCDEFGHIJK (11)
Custom=COUNTIF($A$2:$A$200,A2)=1An ID not yet in the listAn ID typed a second time

With Ignore blank ticked, an empty cell is fine whatever the rule. For drop-down lists in more depth, including lists that grow by themselves and lists that depend on another, see how to add a drop-down list in Excel.

A worked example: a course booking sheet

A training team keeps bookings in four columns. Each one gets its own rule, so the sheet stays easy to count and sort.

ColumnRuleWhy
A: CodeText length, less than or equal to 10, Error Alert StopCodes over 10 characters don't fit the booking system
B: SiteList, Source =$E$2:$E$5 (Leeds, York, Hull, Bradford)COUNTIF can count each site, with no leeds or Leeds left over
C: HoursWhole number between 0 and 40A typing slip such as 400 is stopped
D: Booking dateDate greater than or equal to 01/01/2027Bookings are for next year only

Someone types 45 in C6. With the Error Alert style left at Stop, Excel won't keep it and offers Retry or Cancel. Change the style to Warning and they're asked "Continue?", so 45 can be kept on purpose. Hours typed in before the rule was added aren't checked at all, so finish with Circle Invalid Data to ring any that are over 40.

Keep, copy and remove data validation rules

Saving a workbook with data validation

Save as an Excel Workbook (.xlsx), or .xlsm if it has macros, and every rule, drop-down and message is kept. Two things lose them:

If Excel says it found a problem when the file opens and lists data validation among what it removed, the usual cause is a list typed into Source that's over 255 characters. Put the choices in cells and point Source at them instead.

Copy rules to other cells, sheets or workbooks

Copy a cell that has the rule, select the cells that need it, then use Paste Special and choose Validation. Only the rule is copied, not the value. On Windows, Paste Special is under Home › Paste ▾ or Ctrl+Alt+V. In Excel for Mac it's Edit › Paste Special… or Ctrl+Cmd+V. It works across sheets and into another open workbook. A list that points at cells still points at the same cells, so copy the list into the other workbook too and change Source to use it.

Change every cell with the same rule

Select one cell with the rule, open Data › Data Validation, make the change, and tick Apply these changes to all other cells with the same settings before OK. Every cell with that exact rule changes at once.

Find every cell that has a rule

On Windows, Home › Find & Select › Data Validation selects them all. In Excel for Mac, go to Edit › Find › Go To… (or Control+G), click Special… and choose Data validation. To find only the cells that break a rule, use Data › Data Validation ▾ › Circle Invalid Data.

Remove a rule

Select the cells, open Data › Data Validation, click Clear All, then OK. The values in the cells stay as they are. To take every rule off a sheet, select the whole sheet first (Ctrl+A, or Cmd+A on a Mac).

Pasting over a rule

An ordinary paste brings the copied cell's settings with it, so it replaces the rule, or removes it if the copied cell had none. To paste values without losing the rule, use Paste Special › Values. The rule stays on the cell, but the pasted values aren't checked, so run Circle Invalid Data afterwards.

What you'll practise

  1. Give every cell in C2:C10 a drop-down list with Yes and No. Select C2:C10, then Data, Data Validation…; Allow List, and in Source type Yes,No (a comma between them). OK, then click C2 to see the ▾.
  2. The sites are listed in E2:E5. Make a drop-down list in B2:B10 that uses those cells, so a new site added there shows up in the list. Select B2:B10, Data Validation…, Allow List, then click in Source and select E2:E5 (it becomes =$E$2:$E$5).
  3. Owen Brown in row 5 works at Leeds. Click B5, open its drop-down (the ▾ next to the cell, or Alt+↓) and pick Leeds.
  4. Hours on a course are whole numbers from 0 to 40. Set C2:C10 to allow only those: Allow Whole number, Data between, Minimum 0, Maximum 40.
  5. D2:D10 only allow a decimal from 0 to 1, but nobody knows that until they get it wrong. Select D2:D10 and open Data Validation…. On the Input Message tab, give the title Discount and the message Type 0.1 for 10%. On the Error Alert tab, set the Style to Warning, so a wrong value can still be kept.
  6. C2:C10 now allow whole numbers from 0 to 40, but the hours were typed in before the rule, so some may be over. Find them: Data, Data Validation ▾, Circle Invalid Data. Then change each circled value to 40.
  7. Configure cells C2:C10 so that users can enter only dates on or after 1 January 2027.
  8. Configure cells A2:A11 so that entries can be no more than 10 characters long. If a longer entry is typed, display a Stop error message with the title Too long and the message Use 10 characters or fewer.

Guides with worked examples: How to add a drop-down list in Excel (data validation) · Conditional formatting with a formula: colour a whole row · Excel tables: how to make one, and why it helps

Questions

Why has my data validation gone after saving?

The file was most likely saved as a CSV, which keeps only the values on one sheet: drop-downs and rules are lost. Save as an Excel Workbook (.xlsx) to keep them. If Excel repaired the file when it opened and removed data validation, a list typed into Source was probably over 255 characters; put the choices in cells instead.

How do I copy data validation to another sheet or workbook?

Copy a cell with the rule, select the cells on the other sheet, then use Paste Special and choose Validation (Ctrl+Alt+V on Windows, Ctrl+Cmd+V in Excel for Mac). Only the rule is copied. If the rule is a list that points at cells, copy those cells into the other workbook too and point Source at them.

Why can I still type values that break the rule?

Check the Error Alert tab: a Warning or Information style lets a wrong value be kept, and only Stop refuses it. A rule also checks typing only, so values pasted in or there before the rule are let through. Data › Data Validation ▾ › Circle Invalid Data rings every one of them.

How do I remove data validation in Excel?

Select the cells, go to Data › Data Validation, click Clear All and then OK. It's the same in Excel for Mac. The values already in the cells stay. To find the cells first, use Home › Find & Select › Data Validation on Windows, or Edit › Find › Go To… › Special… › Data validation on a Mac.