Você está na página 1de 11

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 1 of 11

MS EXCEL 2003

DATA VALIDATION

DATA VALIDATION

Excel worksheets are often created to give to other people for the purposes of data collection. In these
cases, you want to make it easy for others to enter correct data and at the same time difficult for them to
enter incorrect data. With a feature called data validation, Excel can assist in several ways.

Ex. 1 Using data validation to restrict data entry


Data validation allows you to restrict entries to a cell or range of cells in various ways. For example,
imagine that you want column A to accept only dates for the first 3 months of the year 2003.
1. Open a new Excel worksheet.
2. Save the file as Excel7_datavalid.xls Note: American and Canadian/British
3. Select column A by clicking on the column heading. date formats are different: By default
Excel uses the American format —
4. Select Data / Validation. Month/Day/Year so that 1/3/03 is
5. In the Settings tab, Allow: box, select Date. January 3, 2003. The Canadian/British
6. Leave the Data option set to Between. date format is Day/Month/Year so that
1/3/03 is March 1, 2003.
7. In the Start Date text box type 1/1/08.
8. In the End Date text box type 3/31/08.
9. Click on OK.
10. Test your new validation settings using any cell in column A:
a. enter several valid dates
b. then enter several invalid dates (e.g. 1/1/02, 4/1/09, etc.), noticing how Excel responds.
11. Explore various data validation options as in the chart below. Then test each one by entering
valid and invalid data. Save the file regularly as you work.

Cell Allow Data


B1 whole number between 1 and 10
C1 whole number not between 0 and 100
D1 decimal greater than or equal to 1000
E1 decimal less than 1
F1 text length less than or equal to 4

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 1 of 11
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 2 of 11

MS EXCEL 2003

DATA VALIDATION

Ex. 2 Data validation — setting criteria with a cell reference


Data criteria can be set through cell references, as well as by entering numbers. The cell referred to can
contain a number, formula or function.
Setting criteria with a cell containing a function:
1. Continue with the file Excel7_datavalid.xls
2. In cell B5, insert the NOW function.
3. Format the cell to show only the day, month and year.
4. In cell C5, use a formula to add 6 to B5.
5. Format B5 like C5. Note: Cell addresses used this way
become part of a data validation
6. In cell D5, allow dates within the current week by setting set formula, so they must be preceded
data validation for Date: Between: =B5 and =C5. by an equal sign (e.g. =B5).

7. Test by entering both valid and invalid dates.

Setting criteria with a cell containing a formula:


8. In cell D10, type Overall Budget.
9. In cell D11, type Office Supplies.
10. Use data validation in E11 to accept decimal values less than or equal to 10% of E10.
11. In E10, type 5000.
12. Test the data validation of E11 by entering both valid and invalid amounts.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 2 of 11
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 3 of 11

MS EXCEL 2003

DATA VALIDATION

Ex. 3 Data validation messages: Input Message


1. Continue with the file Excel7_datavalid.xls
2. Click in B1.
3. Select Data / Validation / Input message
4. Make sure there is a check mark in the box labelled Show input message when cell is selected.
5. In the box labelled Title, type No. of Team Members.
6. In the Input message box, type Whole number between 1 and 10.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 3 of 11
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 4 of 11

MS EXCEL 2003

DATA VALIDATION

7. Click on OK.
8. Click in B1 to see the input message.

A cell with an input message but no error message will accept both valid and invalid entries.
However, Excel detects an invalid entry. Later you will see how to make Excel circle invalid
entries in red.

9. Click in any cell outside B1.

Ex. 4 Data validation messages: Information Message


1. Continue with the file Excel7_datavalid.xls
2. Click in C1.
3. Use the data validation technique learned earlier to restrict values to whole numbers less than
100.
4. Choose Data / Validation / Input message
5. Make sure there is a check mark in the box labelled Show input message when cell is selected.
6. In the box labelled Title, type Serial No..
7. In the Input message box, type Greater than 100.
8. Click on the Error Alert tab.
9. Make sure there is a check mark in the box labelled Show error alert after invalid data is entered.
10. In the box labelled Style, select Information.
11. In the box labelled Title, type Information Message.
12. In the box labelled Error message, type This cell is for whole numbers greater than 100. You can
click OK to enter the number you typed, or click Cancel to type a different number.
13. Click on OK.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 4 of 11
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 5 of 11

MS EXCEL 2003

DATA VALIDATION

14. Enter a valid number in C1, such as 85.


15. Enter several invalid numbers in C1 such as 85.1, 101, 555.

Notice that after the information message appears,


• if you click on Cancel, nothing is entered into the cell
• if you click on OK, the invalid data is entered into the cell

Note: A cell with an information error message will accept both valid and invalid entries.
Excel detects an invalid entry and displays an information message; but the invalid data can
be entered into the cell by clicking on OK.
(Why accept invalid data? You may want it entered but circled in red, which you will leanr to
do in a later exercise.)

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 5 of 11
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 6 of 11

MS EXCEL 2003

DATA VALIDATION

Ex. 5 Data validation messages: Warning Message


1. Continue with the file Excel7_datavalid.xls
2. Click in D1.
3. Use the data validation technique learned earlier to restrict values to decimal numbers equal to or
greater than 1000.
4. Choose Data / Validation / Input message
5. Make sure there is a check mark in the box labelled Show input message when cell is selected.
6. In the box labelled Title, type Time in milliseconds.
7. In the Input message box, type 1000 or more.
8. Choose Data / Validation / Error alert.
9. Make sure there is a check mark in the box labelled Show error alert after invalid data is entered.
10. In the box labelled Style, select Warning.
11. In the box labelled Title, type Warning Message.
12. In the box labelled Error message, type This cell accepts decimal values greater than or equal to
1000. You can click Yes to enter the number you typed and continue filling out this worksheet,
click No to edit your entry, or click Cancel to type a different number.

Note: A cell with an warning error message


will accept both valid and invalid entries.
Excel detects an invalid entry and displays an
information message; but the invalid data can
be entered into the cell by clicking on OK.
13. Click on OK.
14. Enter an invalid number into D1, such as 200 or 1001.5.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 6 of 11
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 7 of 11

MS EXCEL 2003

DATA VALIDATION

Ex. 6 Data validation messages: Stop Message


1. Continue with the file Excel7_datavalid.xls
2. Click in E1.
3. Use the data validation technique learned earlier to restrict values to decimal numbers less than
1.
4. Choose Data \ Validation \ Input message
5. Make sure there is a check mark in the box labelled Show input message when cell is selected.
6. In the box labelled Title, type Number to multiply.
7. In the Input message box, type Less than 1.
8. Click on the Error alert tab.
9. Make sure there is a check mark in the box labelled Show error alert after invalid data is entered.
10. In the box labelled Style, select Stop.
11. In the box labelled Title, type Stop Message.
12. In the box labelled Error message, type This cell accepts only decimal values less than 1. You
won't be allowed to enter anything else in this cell. You can click Retry to edit your entry, or click
Cancel to type a different number.

13. Click on OK.


A cell with a stop error message will not
14. Enter invalid numbers into E1, such as 2, 20,1. accept invalid entries.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 7 of 11
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 8 of 11

MS EXCEL 2003

DATA VALIDATION

Summary of Data Validation Error Messages


Input Message Accepts both valid and invalid data
Invalid data can be red-circled (Tools / Auditing)
Information Message as above
Warning Message Accepts both valid and invalid data
Shows warning message for invalid data
Invalid data can be red-circled (Tools / Auditing)
Stop Message Accepts only valid data

Ex. 7 Red-circling invalid data entries


1. Continue with the file Excel7_datavalid.xls
2. Enter invalid data into C1, D1 and D5. (Remember, because you did not use a Stop error
message, invalid entries were allowed.)
3. Select Tools / Formula Auditing / Show formula auditing toolbar. The Formula Auditing Toolbar
appears.

4. Click on the Circle invalid data icon.


Notice the result. Invalid data is circled in red.
5. Enter valid data into one or two of C1, D1 and D5.

6. Click on the Clear validation circles icon. Notice the result.


7. Click on the Circle invalid data icon. Notice the result.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 8 of 11
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 9 of 11

MS EXCEL 2003

DATA VALIDATION

Ex. 8 Creating a drop-down list by using data valida


A quick and simple method: using a delimited list
1. Continue with the file Excel7_datavalid.xls
2. Click in cell F2.
3. Choose Data / Validation / Settings. The Data Validation dialog box opens.
4. From the Allow: drop-down list, select List.
5. In the "Source:" text box type two items separated by a comma: Pass, More Work Required.

6. Click OK. Notice that a drop-down arrow appears to the right of F2.
Note: This method of Data Validation is case sensitive -- if a user types pass
instead of Pass, an error alert will be displayed.
7. Test the drop-down list in F1.

A second method
1. Continue with the file Excel7_datavalid.xls
2. In the range B10:B13 enter the names Smith, Ho, DeSouza, Singh.
Note: Usually this list would be entered in a remote section of the worksheet where users would
not see it. It can also be placed in another sheet in the same workbook, provided that the range of
cells in the second sheet is named.
3. To name the range, highlight the cells then choose Insert / Name / Define. The Define Name
dialog box opens.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 9 of 11
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 10 of 11

MS EXCEL 2003

DATA VALIDATION

4. Type the name of the range: ExecutiveStaff.


Note: Spaces are not allowed in range names.

5. Click OK. The range B10:B13 may now be referred to with the name ExecutiveStaff.
6. Click in cell F1.
7. Select Data / Validation / Settings.
8. From the Allow: drop-down list, select List.
9. At the right side of the Source field, click on the small red arrow.
10. Highlight B10:B13.
11. Click OK.
12. The drop-down box labelled In-cell must have a check mark in it.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 10 of 11
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 7: Data Validation– Page 11 of 11

MS EXCEL 2003

DATA VALIDATION

13. Create an input message reading Enter Name of Team Member.


14. Create a Warning message reading Name must be a current team member.
15. Click OK.
When F1 is selected, the input message is displayed below the cell.

16. Click on the drop-down button for cell F1. The names in the range B10:B13 are displayed.

17. Test the drop-down list in F1:


a. Type in the name Jones.
Press Enter. The Warning message appears, asking Continue?
Click on Yes.
b. Select a name from the drop-down list.

Ex. 9 Practice
1. Continue with the file Excel7_datavalid.xls.
2. In cell G1,
a. Create a drop-down list for a student’s letter grade: A, B, C, D, E, NA.
b. Use all 3 tabs of the Data Validation dialogue box (Settings, Input Message and Error
alert).
c. Invalid data should not be accepted.
3. In cell H1,
a. Use data validation for an Ontario Secondary School Course Code which must consist of
6 characters (e.g. BTA3O1).
b. Use all 3 tabs of the Data Validation dialogue box.
c. Use a Stop error alert with the message Course code must be the correct code
consisting of 6 letters and numbers. Please click Retry and retype the course code or
click Cancel and speak to your Guidance counsellor for further assistance.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 2: Spreadsheet – Part 7: Data Validation – Page 11 of 11

Você também pode gostar