
Section: Excel & Google Sheets
To use data validation in Excel, select the cells, open Data, then Data Validation, choose what the cell may contain on the Settings tab, and add an input message and an error alert. A Stop error alert rejects invalid direct typing. Warning and Information alerts can be overridden, and paste operations can bypass the check. It is the simplest way to stop a report filling up with typos, text in a number column, or a date outside the month you are collecting. This guide covers list, whole number, date and custom formula rules, the settings most people miss, and the reasons a rule seems to stop working. The sample data is made up.
What data validation does
A validation rule limits what can be typed into a cell. Microsoft's own help lists the choices under Allow: whole number, decimal, list, date, time, text length and custom. Each one takes a condition, such as between 1 and 100, greater than today, or a formula that returns TRUE for an allowed entry. The rule belongs to the cell, not to the value, so it applies to every future entry and can be copied to other cells.
Restrict a cell to a list
- Select the cells that should hold the choice.
- Go to Data, then Data Validation.
- On the Settings tab, set Allow to List.
- In Source, type the items separated by commas, or select a range that holds them.
- Click OK. Each cell now has a drop-down arrow.
Keeping the items in a range is the better habit, because you can add an option without editing every cell. Our guide to the Excel drop-down list covers the same rule from the other direction, and it is the same feature.

Whole numbers, decimals and text length
Set Allow to Whole Number or Decimal, then pick a condition: between, not between, equal to, greater than, less than. For an order quantity, Between 1 and 500 works. For a price, Decimal, Greater than or equal to 0 stops negative amounts. Text Length limits characters, which is useful for codes with a fixed size, such as a three-character region code. Text Length checks character count only; it does not prove the characters are letters or digits.
Dates and times
Set Allow to Date and use a condition such as Between, with the start and end typed in the boxes. To keep a log in the current month, use a formula rule instead, because the fixed dates in the Date option do not move. A rule like =AND(A2>=DATE(YEAR(TODAY()),MONTH(TODAY()),1),A2<=EOMONTH(TODAY(),0)) accepts only dates inside this month and keeps working next month.

Custom formula rules
Set Allow to Custom and type a formula that returns TRUE or FALSE. The formula is written for the first cell of the selected range, and the references move with the range unless you lock them. Four that are worth keeping:
- No duplicates:
=COUNTIF($B$2:$B$200,B2)=1allows a value only once in the column. - Starts with a code:
=LEFT(A2,3)="INV"forces an invoice prefix. - Text only, no numbers:
=ISTEXT(A2)blocks numbers in a name column. - Depends on another cell:
=C2>=B2keeps an end date on or after a start date.
TRUE/FALSE formulas can also drive conditional formatting, and the two work well together. See conditional formatting based on another cell for the formatting side.
Input message and error alert
The Input Message tab shows a small note when someone selects the cell. Tick Show input message when cell is selected and type a short instruction, such as "Enter the invoice date, not the payment date". The Error Alert tab controls what happens after a bad entry. Stop rejects it and offers Retry or Cancel. Warning asks whether to continue. Information accepts the value with a message. Use Stop for data that must be right, and Warning for a soft rule people may need to override.

Copy validation to other cells
Select a cell that has the rule, copy it with Ctrl+C, select the destination, then use Paste Special and choose Validation. That pastes the rule without touching the values or the formatting. Copying a whole cell with Ctrl+V also brings the rule along, but it overwrites the contents, which is usually not what you want.
Find entries that already break the rule
Validation only checks new typing. Values that were in the cells before the rule was added stay there. To find them, open Data, then the arrow next to Data Validation, then Circle Invalid Data. Excel draws a red circle around every cell that fails its rule. Run it again after you fix them, and use Clear Validation Circles to remove the marks.

Common problems
- The drop-down arrow disappeared. Check that the cell has a List rule and that In-cell dropdown is ticked, then check the source range.
- Pasted values ignore the rule. Paste operations can bypass validation or replace the rule. Protection preserves locked cells, but it does not make validation tamper-proof in unlocked input cells. Audit imported and pasted data separately.
- The rule applies to the wrong rows. The formula was written with a relative reference that shifted. Lock the ranges with dollar signs.
- Old values are still there. Use Circle Invalid Data, then fix or delete the cells by hand.
- The validation command is unavailable. Check whether the sheet is protected or the workbook uses a legacy sharing mode. Those settings can prevent changes to validation rules.
- Users can still edit the list range. Protect the sheet so the source cells cannot be changed, as shown in our guide to protecting cells.
Questions and answers
Does data validation stop copy and paste?
No. Paste can bypass the normal entry check. Locked cells on a protected sheet cannot be edited, but users need unlocked cells for input, so protection alone does not validate their pasted values.
Can I use validation on a whole column?
You can select a column and apply a rule, but it is cleaner to apply it to the used range or to a generous fixed range such as A2:A5000.
What is the difference between a list and a custom formula?
A list limits the entry to the items you give. A custom formula allows anything the formula accepts, which can depend on other cells.
Why does my formula rule reject everything?
The formula is probably returning a number or an error instead of TRUE or FALSE, or it refers to the wrong cell. Test it in a spare cell first.
Does data validation work in Excel for the web?
Yes, the main rule types are available there, though a few legacy options are not. Check the specific rule in your browser before you rely on it.
