Excel data validation can restrict what users enter in selected cells—for example, to a number range, a date period, a list, or a value that passes a formula. It is an input-quality aid, not a security barrier: pasting, filling, importing, or editing the workbook in other ways can bypass a rule or replace it.
What data validation can restrict
In Excel for Microsoft 365 on Windows, select the cells, then choose Data > Data Validation. On the Settings tab, select a validation type and define its permitted values. The available types cover common entry rules:
- Whole number: accept integers within a range or meeting a comparison, such as a quantity from 1 to 500.
- Decimal: accept numeric values, including decimals, subject to a limit such as a price greater than or equal to zero.
- List: offer a drop-down of allowed choices, such as Open, In progress, and Closed.
- Date or Time: set a permitted date or time range, such as appointments between two dates.
- Text length: limit the number of characters in a cell, for example to require a code of no more than 12 characters.
- Custom: use a formula that returns TRUE for an acceptable entry and FALSE for an unacceptable one.
For built-in types, the dialog lets you choose a condition such as between, greater than, or equal to, and specify the relevant value or boundaries. You can also select Ignore blank. That option allows an empty cell under the rule; it does not make a required field mandatory. For a required field, use an appropriate custom rule or a separate check that identifies blanks.
Set up a rule and choose its response
After choosing the validation type and its criteria, use the Input Message tab if you want a prompt to appear when someone selects a cell. A useful message explains the expected entry before a mistake happens: “Enter a whole number from 1 to 500.” On the Error Alert tab, choose whether Excel should show a warning and what users can do when an entry does not meet the rule.
The alert style matters. Stop blocks an invalid entry made through ordinary typing in the cell and offers a chance to correct it. Warning tells the user the value does not satisfy the rule but allows the user to proceed. Information displays a notice and also allows the value. These options control the response to an attempted entry; they do not make the worksheet tamper-proof.
- Select the target cell or range, such as D2:D200.
- Open Data > Data Validation and choose the rule type on Settings.
- Enter the permitted condition, then decide whether blanks are allowed.
- Optionally add an input prompt and configure an error alert.
- Test both an allowed and a disallowed value in a representative cell.
Excel for Mac has a Data Validation command on the Data tab, though the ribbon layout can differ. Excel for the web also supports data validation, but available editing controls can vary; if a rule is difficult to configure or inspect there, open the workbook in the desktop app. In all versions, verify the saved rule in the actual cells rather than assuming a copied or imported range retained it.
Custom formulas and practical examples
Custom validation is useful when a built-in condition cannot express the rule. The formula is evaluated for the active cell in the selected range, so references usually need to be written relative to the top-left cell. For example, to require unique, nonblank entries in A2:A100, select A2:A100, choose Custom, and use this formula:
With entries in A2:A100 and the rule applied to A2:A100, enter =AND(A2<>"",COUNTIF($A$2:$A$100,A2)=1). It accepts a nonblank value only when that value occurs once in the range. If A2 contains “North” and no other cell contains “North,” the test is TRUE; if another cell also contains “North,” it is FALSE. The formula’s A2 reference is intentionally relative so it adjusts for each row; the range is fixed with dollar signs.
For a simpler numeric check, use the Whole number type instead of a custom formula whenever possible. It is easier for another workbook editor to understand and maintain. Custom formulas are best reserved for rules involving relationships between cells, such as requiring a start date to be no later than an end date, or preventing duplicate values.
Validation is not a substitute for a formula that reports data quality. If the rule depends on another cell, changes to that other cell may make an existing entry invalid without triggering a new entry attempt. A visible check column, conditional formatting, or a review formula can help reveal such cases. For essential checks, design the workbook so invalid records are detectable even after data has been imported.
Drop-down list restrictions
A list rule is a convenient way to standardize categories, but its source has practical constraints. You can type a short, comma-separated list directly into the Source box, or point the rule to cells containing the choices. A manually typed source is limited to 255 characters, including separators, so a range is usually more dependable for a longer list. It is also easier to update the choices without reopening the validation dialog.
When the options are stored on another worksheet, Excel generally requires a named range rather than a direct cross-sheet range reference in the list Source box. Create a name for the cells containing the options, then use that name as the source. For a list that changes, place the choices in a structured table or use a named range designed to expand; test the drop-down after adding an item, since the validation source must include the new choice.
The “In-cell dropdown” setting controls whether the arrow is shown, not whether the list rule exists. Turning the arrow off does not turn validation off; users may still be expected to type an allowed value. Also, a drop-down should not be treated as proof that every stored cell contains one of its choices. Existing values and pasted data need separate checking.
What validation does not guarantee
The most important limitation is that validation is designed to guide normal cell entry, not enforce a data policy against every possible change. Pasting or filling data can avoid the usual validation prompt, and a paste can bring different cell formatting or validation settings with it. External imports, formulas, macros, and edits in another application can also result in values that do not conform to the rule. Excel behavior can depend on the operation, so do not assume every paste has the same effect.
Validation also does not automatically audit values already present when a rule is added. If a column contains an out-of-range value before you apply a new rule, Excel does not necessarily remove it or present a complete list of violations. Review the existing data separately—for example, filter for suspicious values, use a formula or conditional formatting to flag them, or use a suitable data-cleaning workflow.
Finally, validation is not encryption, access control, or protection against deliberate changes. Worksheet protection can reduce accidental editing, but it is not a substitute for a controlled system when data must meet strict compliance, safety, or security requirements. Use an application or database with appropriate permissions and server-side checks when users must not be able to submit invalid records.
How to find and fix common problems
If an invalid value appears despite a rule, first inspect the rule itself. Select the cell and reopen Data > Data Validation to confirm the criteria, the selected range, and whether the alert style is Stop. If the cell is part of a copied range, compare its settings with a known-good cell. A rule may have been overwritten, applied to only part of the intended column, or configured with the wrong formula reference.
Use Data > Data Validation > Circle Invalid Data to mark values that fail the rules currently applied. This is useful after adding or changing a rule, but it is a review aid, not a permanent monitoring system. Correct the values, revise the rule if it was too restrictive, or clear the circles after review. If the command is unavailable in a particular context, select the relevant cells and inspect them with a formula or other review method.
- Rule blocks a valid entry: check boundary conditions, date interpretation, decimal versus whole-number type, and whether the custom formula refers to the correct row.
- Bad values still appear: check whether they were pasted, filled, imported, or entered after the rule was replaced; run an invalid-data review.
- Drop-down choices are missing: confirm the source range includes all options and that a named range refers to the intended cells.
- Rule works in some rows only: inspect the Applies To range and relative references, particularly in a custom formula.
- Someone cannot leave a cell blank: review Ignore blank and any separate required-field logic; allowing blanks and requiring an entry are different requirements.
Choosing a restriction that fits
Start by defining what “valid” means for the data, including whether blanks are permitted and what should happen when a user makes a mistake. Use a built-in rule for a simple threshold, date range, text length, or fixed list. Choose Custom when the condition depends on other cells or needs a check such as uniqueness. Keep formulas and list sources understandable, and provide an input message that states the expected format rather than merely saying “Invalid.”
Then consider how the workbook will be used. A small, manually maintained form may be well served by validation plus a review step. A workbook receiving regular pasted or imported records needs an explicit audit process, because entry restrictions alone cannot guarantee clean data. For high-consequence records, combine front-end guidance with independent checks and appropriate access controls. The appropriate restriction depends not only on what Excel can accept, but also on how data reaches the cells and what happens if a bad value gets through.
Frequently Asked Questions
Can Excel data validation prevent copy and paste?
No. Validation is not a universal barrier to pasted or imported content. Depending on the operation, invalid values can be entered or the destination rule can be replaced. Check pasted data and confirm validation remains applied afterward.
Does adding validation find invalid values already in a column?
Not by itself. A new rule governs future attempts that are subject to validation, but existing contents need a separate review. Use Circle Invalid Data or another check to locate values that do not meet the rule.
Can a drop-down list use choices from another worksheet?
Yes. Store the choices on that sheet, define a named range for them, and use the name as the list source. A direct reference to another sheet is not generally accepted in the list Source box.
Is data validation a security feature?
No. It helps guide entries and catch ordinary mistakes, but it can be bypassed or changed. Use proper permissions and a system with stronger enforcement if invalid data must be prevented reliably.
Why does Excel allow a value that violates my rule?
The value may have been pasted or imported, the rule may not cover that cell, or the error alert may be set to Warning or Information instead of Stop. Inspect the cell’s rule and run an invalid-data review.
Related
- What Is Power Query? Excel Data Cleanup Explained
- AI and Power Query: What It Can and Cannot Do in Excel
- Power Query Split Cell Into Rows: Steps and Examples
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Why Can’t I Add a Header in Word?You usually can’t add a header in Word because the document is not currently editable, editing is restricted,…
- Import a Color Palette in Excel: Step-by-Step GuideTo import a color palette in Excel for Microsoft 365 on Windows, load an Office theme file (.thmx)…
- Excel Conditional Formatting Data Bars: How to Use ThemIn Excel for Microsoft 365 on Windows, select the numeric cells, then choose Home > Conditional Formatting >…
- PowerShell: Add a Shared Mailbox to OutlookTo make a shared mailbox available in Outlook, use Exchange Online PowerShell to grant the user Full Access;…
- Google Sheets IF Even: Test Numbers for Even or OddTo label a number as even or odd in Google Sheets, use =IF(ISEVEN(A2),"Even","Odd"). If A2 contains 14, the…
- How to Add Page Numbers in MLA Format in WordTo add MLA-style page numbers in Word, insert an automatic page number in the top-right header, then place…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.