More Information: Make A List of Entries Allowed in The Cell
More Information: Make A List of Entries Allowed in The Cell
Make a list of the entries that restricts the values allowed in a cell.
Create messages that appear when incorrect data has been entered.
More Information
This article describes some of the ways to use the data validation feature in Microsoft Excel
as well as examples to illustrate how to implement this feature.
NOTE: The examples below assume you are working with a new Microsoft Excel workbook
and that you start with the first example and continue through the examples in the order in
which they are presented.
You can make a list of the entries you will accept for a cell on a worksheet. You can then
restrict the cell to accept only entries taken from the list by using the data validation feature.
To create a drop-down list and restrict values in the cell to these entries, follow these steps:
4. By default, the Ignore blank and In-cell Dropdown check boxes are selected. Do not
change them.
5. In the Source box, type a,b,c. Click OK.
NOTES:
You can also enter a named range or cell reference if it contains a list of values. Both
must be preceded by an equal sign.
There is a 255 character limitation for this dialog.
6. Cell A1 now has a drop-down list next to it and you can use this list to select the
value to enter in the cell.
7. Click the drop-down list and then click any item it contains.
NOTE: You can manually enter "a", "b", or "c", (without quotation marks) in the cell; you do
not have to select these from the list. If you try to manually enter anything other these
values, a stop message appears and you are unable to keep the value in this cell. Your only
options are Retry or Cancel.
You can create a message that explains the type of data that can be entered in a cell. When
you select the cell, the message appears near the cell. You can move this message, if
necessary, and it remains until you move to another cell or press ESC. If the Office Assistant
is visible, the message appears in a balloon above the Office Assistant.
2. On the Data menu, click Validation and then click the Input Message tab.
NOTE: Make sure the Show input message when cell is selected check box is
selected.
This is the title for the message box that appears. It is in bold text.
5. Click OK.
The drop-down list next to cell A1 and the message for cell A1 both disappear.
Both the drop-down list and the prompt message appear next to cell A1.
NOTE: If the Office Assistant is visible, the prompt message appears in a balloon
above the Office Assistant.
When you select another cell and then select cell A1 again, the message appears in
its new location.
The style of the error message Microsoft Excel displays when you type incorrect data
determines whether the restrictions are enforced. You can display a message that stops you
from entering data values except those specified. You can also display explanatory and
warning messages that let you enter out-of-range data, or you can set limits on the data but
not display any messages.
2. On the Data menu, click Validation and then click the Error Alert tab.
NOTE: Make sure the Show error alert after invalid data is entered check box is
selected.
Create a Stop Alert Message
If you create a Stop Alert message and enter invalid data in the cell, your only
options are Retry or Cancel; you are not allowed to enter invalid data in the cell.
b. In the Title box, type Warning for cell A1. This is the title for the message box
that appears.
c. In the Error Message edit box, enter The only allowable values for cell A1 are
a, b, or c. This is the body of the message that appears and is limited to 225
characters.
d. Click OK.
The Stop Alert message you created appears and your only options are
Retry or Cancel.
6. On the Data menu, click Validation and then click the Error Alert tab.
NOTE: Make sure the Show error alert after invalid data is entered check box is
selected.
If you create a Warning message and enter invalid data in the cell, your options are a
little more flexible than for a Stop Alert message. A Warning Alert message has three
options: Yes, to allow entry of the invalid data; No, to give you a chance to enter
valid data; and Cancel, to remove the invalid entry.
d. Click OK.
The Warning message you created appears asking if you want to Continue.
8. Click Yes.
10. On the Data menu, click Validation and then click the Error Alert tab.
NOTE: Make sure the Show error alert after invalid data is entered check box is
selected.
If you create an Information message and enter invalid data in the cell, your options
are the most flexible. When an Information Alert message appears, you can click OK
to accept the invalid value or you can click Cancel to reject it.
b. In the Title box, type Warning for cell A1. This is the title for the message box
that appears.
d. Click OK.
11. Manually enter p in cell A1.
The Information Alert message you created appears asking if you want to accept or
reject the value you entered.
After your data is entered, you can look for entries that are outside the limits you set. When
you click Circle Invalid Data on the Auditing toolbar, circles appear around cells that contain
incorrect entries. If you correct an invalid entry, the circle disappears.
3. In the Toolbars list, click to select the Auditing check box (if it's not already selected)
and then click Close.
4. On the Auditing toolbar, click the Circle Invalid Data control. Cell A1 is circled.
6. Click the drop-down arrow next to cell A1 and then click one of the entries in the list.
The circle disappears.
You can place limits on the data that can be entered in a cell, you can set minimums and
maximums or check for the effect an entry might have on another cell.
2. On the Data menu, click Validation and click the Settings tab.
3. In the Allow list, click Whole number.
NOTE: You can use cell references for Steps 5 and 6 to specify cells that contain the
minimum and maximum values.
7. Click OK.
8. Enter the value 3 in cell A5. The value is entered without error.
Because the data validation settings you created for cell A1 (an Information Alert) do
not apply to those for cell A5, you receive a Stop Alert message (which is the default
value) and your only options are to click Retry or Cancel.
In the data validation dialog box you can use a formula, an expression or a reference to a
calculation in another cell to determine if the entry you make is valid.
3. On the Data menu, click Validation and click the Settings tab.
=IF(A10>B10,TRUE,FALSE)
NOTE: The formula you enter must begin with an equal sign and it must evaluate to
either true or false. It is not limited to the IF function.
6. Click OK.
8. Click Retry.
You do not receive any error message since this value is greater than the value you
entered in cell B10.