In Excel for Microsoft 365 on Windows, select the cells to control, then choose Data > Data Validation and set a rule on the Settings tab. Use a rule that matches the real requirement, explain the expected entry, choose an appropriate error alert, and test both valid and invalid inputs; validation reduces entry mistakes but does not guarantee that every value in a workbook is correct.
What data validation does
Data validation is a set of rules for what users can enter in selected worksheet cells. It can limit entries to whole numbers, decimals, dates, times, a text length, a list of choices, or a custom formula that evaluates to TRUE or FALSE. For example, a quantity column can allow whole numbers from 1 to 500, while a status column can offer a short dropdown list.
Validation is most useful when people enter data directly into a shared or repeatedly used workbook. It can prevent predictable mistakes at the point of entry, make categories consistent, and give users a prompt when they select a cell. It is not the same as checking the meaning or quality of a complete dataset: a value can meet a rule and still be wrong, such as a valid date entered for the wrong event.
Plan rules around the data
Before setting rules, define what counts as acceptable and what should happen when someone does not know an answer. A field that is genuinely optional should not be forced to contain invented filler such as 0, N/A, or a made-up date. Decide whether blank cells are allowed, whether values have practical minimums and maximums, and whether the rule applies to one cell or a whole input range.
- Use clear units and boundaries. If a column records age in completed years, specify whole numbers and a plausible range rather than accepting any decimal.
- Separate different kinds of information. A date, a status label, and a free-text comment usually need different rules.
- Keep the rule consistent with the process. If a business process changes, update the validation rule and any instructions that refer to it.
- Consider how users enter data. A dropdown is helpful for a small, stable set of choices, but can be cumbersome for a very long list.
Validation is a workbook design decision, not merely a formatting task. Agreeing on definitions first helps prevent rules that are technically valid but confusing or too restrictive.
Choose the right validation type
On the Settings tab of the Data Validation dialog, the Allow menu contains the main rule types. The available criteria depend on the selected type. Common uses include:
- Whole number: restrict quantities, counts, or other values that must not contain fractions.
- Decimal: allow measured or calculated values within a specified interval.
- List: provide a dropdown of approved values, such as Open, In progress, and Complete.
- Date or Time: limit entries to a date or time range, such as dates in a reporting period.
- Text length: cap the number of characters in a code or short description.
- Custom: apply a formula when the built-in criteria cannot express the requirement.
For a numeric or date rule, choose a condition such as between, greater than, or less than, then enter the appropriate boundary values. Check that the boundary is inclusive or exclusive as intended. For instance, “between 1 and 500” permits both 1 and 500. The default Allow setting may be Any Value, which imposes no meaningful restriction, so confirm the selected type before saving.
Build dropdown lists carefully
A list is often the clearest way to standardize categories and avoid variations such as “In progress,” “In Progress,” and “In-progress.” Select the destination cells, open Data > Data Validation, choose List under Allow, and provide the list source. Keep the In-cell dropdown option selected when users should choose from a visible menu.
For a short list that rarely changes, values can be entered directly in the Source box, separated by the list separator used by the computer. For a list that changes, store the choices in worksheet cells and use that range as the source. Keeping choices in cells makes updates easier to audit and reduces the chance that the rule and the approved options become inconsistent. If the source is on another worksheet, create a defined name for the source range and use that name in the validation rule; a direct cross-worksheet reference in the Source box is not the reliable approach.
Sort choices in a way that helps users scan them, use concise labels, and include an explicit option such as “Not applicable” only when it has a defined meaning. A dropdown does not make a choice factually correct: it only limits the available entries. Also consider what happens when an approved label is renamed, because existing cell values may retain the old wording.
Use custom formulas with care
Custom validation is useful for rules that depend on another cell or need a condition not offered in the standard menus. The formula must evaluate to TRUE for an acceptable entry. When applying a formula to a range, write it for the top-left cell of that range and use relative references where the rule should adjust for each row. Use dollar signs only where a reference should stay fixed.
With an identifier entered in A2 and the rule applied to A2:A100, this formula permits blanks but requires each nonblank identifier to occur only once in that range: =OR(A2="",COUNTIF($A$2:$A$100,A2)=1). The anchored range stays fixed as the rule evaluates each row, while A2 adjusts. Test the formula with a new identifier, a duplicate, and a blank before applying it across a larger table.
Custom formulas can become difficult to understand or maintain. Add a short instruction near the input area, document unusual rules, and avoid trying to validate complex real-world formats with a simplistic pattern. For example, checking whether a text value contains an at sign does not establish that it is a valid or deliverable email address. If correctness matters, use an appropriate verification process rather than relying on a cell rule alone.
Make prompts and error messages useful
The Input Message tab can show a short instruction when a user selects a validated cell. Use it to clarify units, expected format, or a boundary that may not be obvious from the column heading. A prompt such as “Enter a whole number from 1 to 500” is more useful than “Enter value.” Keep messages brief enough to read without obscuring the worksheet.
The Error Alert tab controls what users see after an invalid entry. A Stop alert prevents a user from accepting an invalid value typed into the cell. Warning and Information alerts communicate a problem but allow the user to proceed. Choose the style based on the consequence of an incorrect entry, not on how strict the spreadsheet looks. A warning is appropriate only if proceeding can be legitimate and users understand the exception; a critical required range generally calls for a firmer control.
Use a specific error message that explains how to correct the entry. For example, say “Choose a status from the dropdown” rather than “Invalid input.” If the rule is not self-explanatory, revise the worksheet heading or input message as well. Clear guidance is more effective than an alert that merely rejects an entry.
Test, copy, and maintain rules
After applying validation, test it as a user would. Try an acceptable value, a value just below the minimum, one just above the maximum, a blank if blanks matter, and a value with the wrong type. For a list, check that the dropdown appears and that the choices match the approved source. For a custom formula, test boundary cases and interactions with neighboring cells.
Excel applies validation to selected cells, but copying cells or filling ranges can also copy or replace validation settings. Before distributing a workbook, inspect representative input cells and confirm that the intended ranges still have the correct rules. To reuse a rule, copy a correctly validated cell and use Paste Special > Validation where available in the Windows desktop ribbon workflow; verify the destination afterward rather than assuming the rule transferred as intended.
Validation rules do not automatically repair existing entries. To find existing values that violate rules, select the relevant cells and choose Data > Data Validation > Circle Invalid Data. Review the marked cells, correct or explain exceptions, and use Clear Validation Circles when finished. When a rule is changed, check both historical data and future input: tightening a boundary may reveal older values that no longer comply.
Know the limits and protect the workbook
Data validation is a helpful entry guardrail, not a security feature or a complete data-quality system. Pasting, filling, importing, or changing a cell through other workbook operations can introduce values that do not follow the intended rule. Existing invalid values can also remain after a rule is added. Periodic checks, careful review, and appropriate protection or process controls may be needed for important workbooks.
Validation also cannot determine whether a person selected the right option or entered a plausible value for the right record. A date in range may still refer to the wrong transaction; a dropdown status may be selected incorrectly. For important datasets, combine input rules with review, reconciliation, and checks across related columns. Protecting worksheet structure can reduce accidental changes to formulas or setup, but it should not be treated as a substitute for access controls or a validated data system.
In Excel for Microsoft 365 on Windows, the usual path is Data > Data Validation. Excel for Mac has a Data Validation command on the Data tab as well, though dialog layout and some ribbon details can vary by release. Excel for the web supports common validation tasks, but advanced workbook behavior and some editing options may differ from the desktop application. If a workbook is used across platforms, test its rules in the versions the team actually uses.
Frequently Asked Questions
Does Excel data validation stop every invalid entry?
No. A Stop alert can reject invalid values typed directly into a validated cell, but copying, filling, importing, or other edits can bypass the intended rule. Existing values are not automatically checked when the rule is created, so inspect and periodically review the data.
Can I make a dropdown list from another worksheet?
Yes. Put the choices on another sheet, define a name for the source range, and use that name as the list source. This is easier to maintain than embedding a long set of choices in the validation dialog.
How do I find invalid values already in a worksheet?
Select the cells and use Data > Data Validation > Circle Invalid Data in desktop Excel. Excel marks entries that do not meet the applicable rules, allowing you to inspect and correct them. The command does not decide whether a compliant value is factually correct.
Why can someone enter a value that breaks my rule?
They may have pasted or filled the cell, or the cell may not have the expected validation rule. Check the exact range, confirm the Error Alert is enabled and set to Stop when appropriate, and test the workbook after copying or changing its layout.
Can validation check that an email address or date is real?
Not reliably by itself. A cell rule can check simple properties or a date range, but it cannot confirm that an email address can receive messages or that a date is correct for a particular event. Use suitable verification or review when that distinction matters.
Related
- Data Validation: Definition, Rules, and Examples
- Excel Data Validation Date Picker: Setup and Options
- Excel Data Validation for Dates: Rules 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
- Export Outlook Contacts to Excel: Steps and OptionsYes. You can export Outlook contacts to a comma-separated values (CSV) file and open that file in Excel;…
- Excel Insert Row After Change in Data AutomaticallyTo insert a row after each change in a sorted Excel list, use a short VBA macro to…
- Conditional Formatting: Highlight Duplicates in ExcelYes. In Excel for Microsoft 365 on Windows, select the cells to check, then choose Home > Conditional…
- Google Sheets Filter by Last Name: Sort and SearchYes. In Google Sheets in a web browser, select the full table, choose Data > Create a filter,…
- Excel Conditional Formatting for Drop-Down ListsTo color an Excel drop-down selection automatically, create the list with Data Validation, then add a conditional-formatting rule…
- Share an Outlook Calendar With a QR Code: How It WorksYes—but Outlook does not generally create a QR code for sharing a calendar. You can publish a calendar…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.