Validation
Validation
Intro
Overview and samples of data validation Web Page
The Basics
Custom Option
linked Lists
On Off Validation
The purpose of Validation is to try and ensure a user does not enter invalid data into a cell or a range of cells.
This Workbook shows various examples of how Validation can be used for different user needs
All Blue Cells In the Workbook have Validation applied. Select any of these cells and choose
Data>Validation via the Worksheet Menu Bar to see the criteria used.
Next >>
<< Previous
ome extremely popular
or a range of cells.
s and choose
The Basics
Back to Index
Next >>
<< Previous
To see Validation settings
Select the cell below the heading
and go to Data>Validation
Enter data ouside the range to see
error messages
1/01/04
11:00 AM
Next >>
<< Previous
Cat
Chicken
Cow
Dog
Horse
Mouse
Rat
Sheep
Back to Index Custom Option
As long as the formula evaluates to True, the numbers entered into A2:A19
will be accepted
Example 1
Year 2005 All Formulae used in the Custom option of Data>Validation
$ 256.32 must evaluate to True or False
$ 125.63
$ 258.00 TIP: You will often find it easier to first place your formula into any cell
$ 56.32 The cell below contains the formula used in Validation of A6:A23
$ 356.21 1 All gray cells house the formula used in the Validation Custom
$ 566.00 option
$ 200.00
$ 324.11 Example 2 Example 3 Example 4
$ 258.36 Enter Data Below Headings Enter any data below Stop Duplicates
$ 1,000.00 Name Age Dave
Bill
1 1 0 0 John
0 0 Harry
Example 5
Names Department Example 6 Example 7
Fred Finance Number Text
Bill Marketting
Mary Finance 0 0
$ 3,400.95 Bob
Example 8 Next >>
Data << Previous
Horses 1
1 1 Cats 1
1 1 1
1 1 0
0 0 0
0 0 0
0 0 0
Stop Duplicates
1
1
1
1
0
0
0
0
Back to Index List From Another Worksheet
Normally, Excel will not allow you to use the List option when the List is on another Worksheet.
1: Name our list range, then use the Name as the List Source
2: Place the referenced List Range inside the INDIRECT Function
The list for both Validated cells above resides on a Worksheet named Hidden Lists. The Sheet is hidden, to
see it go to Format>Sheet>Unhide
Next >>
<< Previous
Back to Index Linked Lists
Categories Items
Fruit Fruit Vegetable Sweets Building Products
Vegetable Apples Carrots Peppermints Nails
Sweets Oranges Lettuce Chocolates Hammers
Building Products Pears Cabbages Sherbet Saw
Bananas Onions Ice Cream Bricks
How it Works
The range A3:A6 has been Named "Categories"
The lists below the Item heading have been Named the same as their headings.
The Create names option via Insert>Name>Create is a quick & easy way to name ranges.
Example: Select B3:E7 and go to Insert>Name>Create. Ensure only Top Row is checked and click
In the case of: Building Products an Underscore is added in place of the space, that is Building_Products. This
is because Named Ranges cannot contain spaces.
The INDIRECT function is used in the List option of Validation to force Excel to see any text as a Range Name
and not Text.
The SUBSTITUTE Function has also been used in the Validation for C11 to replace any spaces with the underscore
See Excel help on the INDIRECT and SUBSTITUTE Function
Next >>
<< Previous
g Products
Nomally when Validation has been applied one would be required to remove the Validation so that data, outside
any validated range, can be entered. This method shows how we can use a CheckBox (from the Forms toolbar) to
quickly and easily toggle validation on and off.
0 Turn Validation On
Any Entries Formulas Used To see the Checkboxes Cell Link ($A$9), right click on it and
1 choose "Format Control" then click the "Control" page tab.
1
1
1 While the CheckBox is checked (TRUE) only numbers can be
1 entered into A11:21. While the CheckBox is not checked (
1 any entries (text or numbers) can be entered into A11:21
1
1
1 Next >>
1 << Previous
1
so that data, outside
he Forms toolbar) to
y numbers can be
not checked (FALSE)
d into A11:21.
Back to Index Updating Validation List
One draw-back with the List option of Validation is that there is no standard way for a user to add new
list entries without adding them to the List first, then selecting from the List. This method uses some VBA
code and an Dynamic Named Range to overcome this.
Dymanic Named Ranges (Web Page)
To see the VBA code, right click on the sheet name tab and select View Code
<< Previous