Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to...

52
Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base is accurate. If we fail to satisfy this criteria, everything we do with the data is suspect. While we cannot achieve the goal of perfect data, we should do whatever is possible to minimize the possibility of errors. Traditionally, the strategy for assuring data integrity was redundancy, i.e. enter the data twice and compare each item. If the redundant items agree, we assume they are correct. If the items are different, the data entry is reviewed to determine which is correct. Given the volume of information that many organizations retain, entering data twice is too expensive to implement. Software programs, like Excel, now support validation, which involves checking to make sure that the data entered is not an error. This does not promise that the entry is correct, only that it is not an obvious error. In this tutorial, we will add validation to the different columns in our list. While Excel helps eliminate errors, its implementation is limited. It only tests our Validating Data Entry, Slide 1 Copyright © 2004, Jim Schwab, University of Texas at Austin

Transcript of Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to...

Page 1: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Validating Data Entry

The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base is accurate. If we fail to satisfy this criteria, everything we do with the data is suspect. While we cannot achieve the goal of perfect data, we should do whatever is possible to minimize the possibility of errors.

Traditionally, the strategy for assuring data integrity was redundancy, i.e. enter the data twice and compare each item. If the redundant items agree, we assume they are correct. If the items are different, the data entry is reviewed to determine which is correct.

Given the volume of information that many organizations retain, entering data twice is too expensive to implement. Software programs, like Excel, now support validation, which involves checking to make sure that the data entered is not an error. This does not promise that the entry is correct, only that it is not an obvious error.

In this tutorial, we will add validation to the different columns in our list. While Excel helps eliminate errors, its implementation is limited. It only tests our validation criteria while a user is entering data. It will not test validation when data is copied and pasted or when the validation involves a comparison of data values involves an empty cell.

Validating Data Entry, Slide 1 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 2: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Validating a numeric entry

Suppose we wanted the ID Number to be a whole number (no decimals places) that has at least 4 digits.

Suppose we wanted the ID Number to be a whole number (no decimals places) that has at least 4 digits.

First, click on cell A2 as the target for validating ID Numbers.

First, click on cell A2 as the target for validating ID Numbers.

Second, select Validation from the Data menu.

Second, select Validation from the Data menu.

Our criteria for ID Numbers is that they be whole numbers that are 4 digits long. This means that we want to accept whole numbers that are greater than 999.

Our criteria for ID Numbers is that they be whole numbers that are 4 digits long. This means that we want to accept whole numbers that are greater than 999.

Validating Data Entry, Slide 2 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 3: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 1

The settings tab of the data validation dialog box enables to set specifications for legal and illegal entries in the data field.

The settings tab of the data validation dialog box enables to set specifications for legal and illegal entries in the data field.

For what type of data to Allow, select Whole number from the drop down menu. When the type of data is selected, new fields appear to accept additional specifications.

For what type of data to Allow, select Whole number from the drop down menu. When the type of data is selected, new fields appear to accept additional specifications.

Validating Data Entry, Slide 3 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 4: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 2

On the Data drop down menu, we select the allowable relationship between the cell entry and the permissible values

On the Data drop down menu, we select the allowable relationship between the cell entry and the permissible values

Since our specifications is only that the number be greater than 999, we select greater than from the drop down menu.

Since our specifications is only that the number be greater than 999, we select greater than from the drop down menu.

Validating Data Entry, Slide 4 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 5: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 3

Since we are specifying a greater than relationship. we only have to enter the minimum value, which is this case is 999.

Since we are specifying a greater than relationship. we only have to enter the minimum value, which is this case is 999.

Our complete specification is that an entry will be allowed in the cell if it is a whole number greater than 999.

Our complete specification is that an entry will be allowed in the cell if it is a whole number greater than 999.

Validating Data Entry, Slide 5 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 6: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 4

Finally, we clear the check box for Ignore blank.

Fields are often left blank to indicate that a data item is missing or unavailable. Marking the check box to Ignore blank means that blanks will not be treated as errors. We can jump over a cell when we are entering data, but once we have started entering data, we must include a valid entry.

Finally, we clear the check box for Ignore blank.

Fields are often left blank to indicate that a data item is missing or unavailable. Marking the check box to Ignore blank means that blanks will not be treated as errors. We can jump over a cell when we are entering data, but once we have started entering data, we must include a valid entry.

Validating Data Entry, Slide 6 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 7: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - input message - 1

When our settings are complete, click on the Input message tab to enter a prompt or instruction that will appear when the user selects a cell in this column for data entry. The Input Message tab has two items to complete: the Title text box and the Input Message text box.

When our settings are complete, click on the Input message tab to enter a prompt or instruction that will appear when the user selects a cell in this column for data entry. The Input Message tab has two items to complete: the Title text box and the Input Message text box.

Validating Data Entry, Slide 7 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 8: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - input message - 2

First, we type the title which is the first line of the message, printed in bold type. Type in the name of the field ID Number.

First, we type the title which is the first line of the message, printed in bold type. Type in the name of the field ID Number.

Second, we type in a message that informs the user what they are expected to enter, in this case Enter a four digit number.

Second, we type in a message that informs the user what they are expected to enter, in this case Enter a four digit number.

Validating Data Entry, Slide 8 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 9: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - error alert - 1

When our input message is complete, click on the Error Alert tab to specify the computers response when the user enters incorrect data.

When our input message is complete, click on the Error Alert tab to specify the computers response when the user enters incorrect data.

The error alert specifies the feedback given to the user when they have typed an incorrect entry. We can select a style for the dialog box that contains the feedback. Style controls the options the user is given when an incorrect entry is displayed. The 'Stop' style requires the user to retype the entry. The 'Warning' and 'Information' styles inform the user of the mistake, but allow the incorrect data to remain in the cell.

We will usually choose Stop to require the user to correct errors.

The error alert specifies the feedback given to the user when they have typed an incorrect entry. We can select a style for the dialog box that contains the feedback. Style controls the options the user is given when an incorrect entry is displayed. The 'Stop' style requires the user to retype the entry. The 'Warning' and 'Information' styles inform the user of the mistake, but allow the incorrect data to remain in the cell.

We will usually choose Stop to require the user to correct errors.

Validating Data Entry, Slide 9 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 10: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - error alert - 2

First, we type in the Title of the window in which the alert message appears. We will use the name of the field: ID Number.

First, we type in the Title of the window in which the alert message appears. We will use the name of the field: ID Number.

Second, we type in the Error message which tells the user what to do to correct the error: The ID Number is the four digit number in the upper right hand corner of page 1 of the questionnaire.

Second, we type in the Error message which tells the user what to do to correct the error: The ID Number is the four digit number in the upper right hand corner of page 1 of the questionnaire.

Third, we click on the OK button to conclude our Data Validation entry.

Third, we click on the OK button to conclude our Data Validation entry.

The 'Title' and 'Error message' text boxes contain the text of the feedback to the user.

The 'Title' and 'Error message' text boxes contain the text of the feedback to the user.

Validating Data Entry, Slide 10 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 11: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The input prompt for ID Number

Since cell A2 was selected when we entered the validation criteria, it now displays the input prompt which we specified.

Since cell A2 was selected when we entered the validation criteria, it now displays the input prompt which we specified.

If the box with the input prompt is covering the cell contents, move it to the right.

If the box with the input prompt is covering the cell contents, move it to the right.

Validating Data Entry, Slide 11 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 12: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Entering a correct ID Number

When we enter a correct ID Number, e.g. 1001, and press the Enter key, Excel checks our input against the validation criteria. If our entry satisfies the criteria, Excel accepts the entry and advances the asterisk to the next cell, A3. We have increased the records in our list by 1.

When we enter a correct ID Number, e.g. 1001, and press the Enter key, Excel checks our input against the validation criteria. If our entry satisfies the criteria, Excel accepts the entry and advances the asterisk to the next cell, A3. We have increased the records in our list by 1.

Since the Enter key moves us down one row in the same column, the input prompt is displayed again for cell A3.

Since the Enter key moves us down one row in the same column, the input prompt is displayed again for cell A3.

Validating Data Entry, Slide 12 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 13: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Entering an incorrect ID Number

When we enter an incorrect number for ID, e.g. 101 which is not four digits, Excel displays our Error Alert message.

When we enter an incorrect number for ID, e.g. 101 which is not four digits, Excel displays our Error Alert message.

We click on the Retry button and correct our entry.

We click on the Retry button and correct our entry.

If we were to click on the Cancel button, Excel undoes the data entry.

If we were to click on the Cancel button, Excel undoes the data entry.

Validating Data Entry, Slide 13 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 14: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The corrected ID Number

We correct the ID number to 1002, which Excel accepts and moves to the next row.

We correct the ID number to 1002, which Excel accepts and moves to the next row.

Validating Data Entry, Slide 14 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 15: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Entering another incorrect ID Number

When we enter an incorrect number for ID with a decimal fractions, e.g. 100.3, Excel displays our Error Alert message.

When we enter an incorrect number for ID with a decimal fractions, e.g. 100.3, Excel displays our Error Alert message.

We click on the Retry button and correct our entry.

We click on the Retry button and correct our entry.

If we were to click on the Cancel button, Excel undoes the data entry.

If we were to click on the Cancel button, Excel undoes the data entry.

Validating Data Entry, Slide 15 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 16: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The corrected ID Number

We correct the ID number to 1003, which Excel accepts and moves to the next row.

We correct the ID number to 1003, which Excel accepts and moves to the next row.

Validating Data Entry, Slide 16 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 17: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Validating a text entry with a list

Select cells B2 through B5 to apply validation to the cells in the list in the column for Sex.

Select cells B2 through B5 to apply validation to the cells in the list in the column for Sex.

Select Validation from the Data menu to open the Validation dialog box.

Select Validation from the Data menu to open the Validation dialog box.

Validating Data Entry, Slide 17 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 18: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 1

The settings tab of the data validation dialog box enables to set specifications for legal and illegal entries in the data field.

The settings tab of the data validation dialog box enables to set specifications for legal and illegal entries in the data field.

The acceptable entries for Sex are Male and Female. When we have only a few optional responses, we can use a drop down list for data entry. Select List as the type of data to allow.

The acceptable entries for Sex are Male and Female. When we have only a few optional responses, we can use a drop down list for data entry. Select List as the type of data to allow.

Validating Data Entry, Slide 18 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 19: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 2

First, we enter the response options as comma separated text, i.e. we type Male and Female in the Source text box, separated by a comma, i.e. Male,Female.

First, we enter the response options as comma separated text, i.e. we type Male and Female in the Source text box, separated by a comma, i.e. Male,Female.

Second, we mark the Ignore blank checkbox as we will treat blanks as missing data. Since we want a drop down list, we mark the In-cell dropdown checkbox.

Second, we mark the Ignore blank checkbox as we will treat blanks as missing data. Since we want a drop down list, we mark the In-cell dropdown checkbox.

Validating Data Entry, Slide 19 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 20: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - input message - 1

When our settings are complete, click on the Input message tab to enter a prompt or instruction that will appear when the user selects a cell in this column for data entry.

When our settings are complete, click on the Input message tab to enter a prompt or instruction that will appear when the user selects a cell in this column for data entry.

First, we enter the field name Sex in the title which is the first line of the message, printed in bold type.

First, we enter the field name Sex in the title which is the first line of the message, printed in bold type.

Second, we type in a message that informs the user what they are expected to enter: Select Male or Female from the drop-down list.

Second, we type in a message that informs the user what they are expected to enter: Select Male or Female from the drop-down list.

Third, since we expect our users to select from a menu, we do not expect them to mistype their entry. We will not include a specific error message. Click on the OK button.

Third, since we expect our users to select from a menu, we do not expect them to mistype their entry. We will not include a specific error message. Click on the OK button.

Validating Data Entry, Slide 20 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 21: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The input prompt for Sex

Since cell B2 was selected when we entered the validation criteria, it now displays the input prompt which we specified.

Since cell B2 was selected when we entered the validation criteria, it now displays the input prompt which we specified.

If the box with the input prompt is covering the cell contents, move it to the right.

If the box with the input prompt is covering the cell contents, move it to the right.

Validating Data Entry, Slide 21 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 22: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Selecting a choice for sex

When we select a cell, e.g. B2, in the Sex column, both the arrow for the drop down list and the Input Message prompt appear.

When we select a cell, e.g. B2, in the Sex column, both the arrow for the drop down list and the Input Message prompt appear.

We highlight our choice from the drop down menu.

We highlight our choice from the drop down menu.

When we release the mouse button, Excel fills in the cell with our choice.

When we release the mouse button, Excel fills in the cell with our choice.

Validating Data Entry, Slide 22 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 23: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Typing an incorrect entry for Sex

If a user types an entry directly in the that does not match a choice on the list, e.g. Man instead of Male, Excel displays its default error message because we did not specify an error alert for this column.

If a user types an entry directly in the that does not match a choice on the list, e.g. Man instead of Male, Excel displays its default error message because we did not specify an error alert for this column.

Click on Retry and correct the entry.

Click on Retry and correct the entry.

Validating Data Entry, Slide 23 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 24: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Validating a text entry with a long list

A drop down list may have more entries than can reasonably appear in the Source box for a validation list. In this case, we can enter the alternatives on a section of a worksheet and use that section as the source for the items in a drop down list.

The conservator field in our database is a field with a long list of possible options: biological parents, adoptive parents, biological mother, biological father, adoptive mother, adoptive father, child welfare, and juvenile court. We will create this list from a section of Sheet2, which we will rename Codes.

A drop down list may have more entries than can reasonably appear in the Source box for a validation list. In this case, we can enter the alternatives on a section of a worksheet and use that section as the source for the items in a drop down list.

The conservator field in our database is a field with a long list of possible options: biological parents, adoptive parents, biological mother, biological father, adoptive mother, adoptive father, child welfare, and juvenile court. We will create this list from a section of Sheet2, which we will rename Codes.

Validating Data Entry, Slide 24 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 25: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Entering a list of codes

Validating Data Entry, Slide 25 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 26: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Naming the list of acceptable entries for conservator

A worksheet range can only be used as the source for a validation drop down list if it has a name instead of a cell reference.

A worksheet range can only be used as the source for a validation drop down list if it has a name instead of a cell reference.

First, to assign a name to cells A1:A8 on the Codes worksheet, we highlight the eight cells.

First, to assign a name to cells A1:A8 on the Codes worksheet, we highlight the eight cells.

Second, we click on the Name Box. The old name A1 is selected for replacement.

Second, we click on the Name Box. The old name A1 is selected for replacement.

Validating Data Entry, Slide 26 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 27: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Name the cells

With cells A1 through A8 selected, we type the name ConservatorCodes in the Name Box and press the Enter key to complete the change.

With cells A1 through A8 selected, we type the name ConservatorCodes in the Name Box and press the Enter key to complete the change.

Validating Data Entry, Slide 27 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 28: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Using ConservatorCodes for validation

First, return to Sheet1 and select cells C2 through C5, which we will validate with the named list.

First, return to Sheet1 and select cells C2 through C5, which we will validate with the named list.

Second, select Validation from the Data menu to open the Validation dialog box.

Second, select Validation from the Data menu to open the Validation dialog box.

Validating Data Entry, Slide 28 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 29: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 1

The settings tab of the data validation dialog box enables to set specifications for legal and illegal entries in the data field.

The settings tab of the data validation dialog box enables to set specifications for legal and illegal entries in the data field.

The acceptable entries for Conservator are the list of ConservatorCodes. Select List as the type of data to allow.

The acceptable entries for Conservator are the list of ConservatorCodes. Select List as the type of data to allow.

Validating Data Entry, Slide 29 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 30: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 2

First, we enter the response options as a reference to a named set of cells in the workbook, i.e. we type =ConservatorCodes.

Do not forget the equal sign (=) at the beginning of the entry.

First, we enter the response options as a reference to a named set of cells in the workbook, i.e. we type =ConservatorCodes.

Do not forget the equal sign (=) at the beginning of the entry.

Second, we mark the Ignore blank checkbox as we will treat blanks as missing data. Since we want a drop down list, we mark the In-cell dropdown checkbox.

Second, we mark the Ignore blank checkbox as we will treat blanks as missing data. Since we want a drop down list, we mark the In-cell dropdown checkbox.

Validating Data Entry, Slide 30 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 31: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - input message - 1

When our settings are complete, click on the Input message tab to enter a prompt or instruction that will appear when the user selects a cell in this column for data entry.

When our settings are complete, click on the Input message tab to enter a prompt or instruction that will appear when the user selects a cell in this column for data entry.

First, we enter the field name Enter child's conservator in the title which is the first line of the message, printed in bold type.

First, we enter the field name Enter child's conservator in the title which is the first line of the message, printed in bold type.

Second, we type in a message that informs the user what they are expected to enter: Select the child's conservator from the drop-down list of choices.

Second, we type in a message that informs the user what they are expected to enter: Select the child's conservator from the drop-down list of choices.

Third, since we expect our users to select from a menu, we do not expect them to mistype their entry. We will not include a specific error message. Click on the OK button.

Third, since we expect our users to select from a menu, we do not expect them to mistype their entry. We will not include a specific error message. Click on the OK button.

Validating Data Entry, Slide 31 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 32: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The input prompt for conservator

Since cell C2 was selected when we entered the validation criteria, it now displays the input prompt which we specified.

Since cell C2 was selected when we entered the validation criteria, it now displays the input prompt which we specified.

If the box with the input prompt is covering the cell contents, move it to the right.

If the box with the input prompt is covering the cell contents, move it to the right.

Validating Data Entry, Slide 32 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 33: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Selecting a choice for conservator

When we select a cell, e.g. C2, in the Conservator column, both the arrow for the drop down list and the Input Message prompt appear.

When we select a cell, e.g. C2, in the Conservator column, both the arrow for the drop down list and the Input Message prompt appear.

We highlight our choice from the drop down menu.

We highlight our choice from the drop down menu.

When we release the mouse button, Excel fills in the cell with our choice.

When we release the mouse button, Excel fills in the cell with our choice.

Validating Data Entry, Slide 33 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 34: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Validation for date of birth - acceptable range of dates

Since my data base is made up of children between the ages of 10 and 18, I need to make sure that their date of birth would result in an age in that range. Using September 1, 2004 as a reference date, a person would be 10 or older if they were born on September 1, 1994 or before. Likewise a person would be 18 or younger if they were born after September 1, 1986.

The acceptable range of dates for my list is, therefore, between September 1, 1986 and September 1, 1994. If they were born prior to that date they would be too old for my program. If they were born after that date, they would be too young for my program.

Note that the validation of birth dates is also the criteria for validation age. If the birth date is correct, the formula that computes age will also be correct.

Since my data base is made up of children between the ages of 10 and 18, I need to make sure that their date of birth would result in an age in that range. Using September 1, 2004 as a reference date, a person would be 10 or older if they were born on September 1, 1994 or before. Likewise a person would be 18 or younger if they were born after September 1, 1986.

The acceptable range of dates for my list is, therefore, between September 1, 1986 and September 1, 1994. If they were born prior to that date they would be too old for my program. If they were born after that date, they would be too young for my program.

Note that the validation of birth dates is also the criteria for validation age. If the birth date is correct, the formula that computes age will also be correct.

Validating Data Entry, Slide 34 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 35: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Validation for date of birth - establishing the criteria

Select cells D2 through D5 to apply validation to the cells in the list in the column for Date of Birth.

Select cells D2 through D5 to apply validation to the cells in the list in the column for Date of Birth.

Select Validation from the Data menu to open the Validation dialog box.

Select Validation from the Data menu to open the Validation dialog box.

Validating Data Entry, Slide 35 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 36: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 1

The settings tab of the data validation dialog box enables to set specifications for legal and illegal entries in the data field.

The settings tab of the data validation dialog box enables to set specifications for legal and illegal entries in the data field.

We want to limit the user's entries for Date of Birth to something that Excel can interpret as a date. Select the Date option from the list of allowable values.

We want to limit the user's entries for Date of Birth to something that Excel can interpret as a date. Select the Date option from the list of allowable values.

Validating Data Entry, Slide 36 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 37: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 2

First, we accept the default of a between relationship for a range of values.

First, we accept the default of a between relationship for a range of values.

Second, we enter 9/1/1986 in the Start date text box.

Second, we enter 9/1/1986 in the Start date text box.

Third, we enter 9/1/1994 in the End date text box.

Third, we enter 9/1/1994 in the End date text box.

Fourth, we mark the Ignore blank checkbox as we will treat blanks as missing data.

Fourth, we mark the Ignore blank checkbox as we will treat blanks as missing data.

Validating Data Entry, Slide 37 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 38: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - input message - 1

First, we click on the Input Message tab to navigate to that page.

First, we click on the Input Message tab to navigate to that page.

Second, we enter the title, Enter Date of Birth which will be first line of the message, printed in bold.

Second, we enter the title, Enter Date of Birth which will be first line of the message, printed in bold.

Third, we type in a message that informs the user what they are expected to enter: Enter a date between 9/1/1986 and 9/1/1994 in the format: mm/dd/yyyy.

Third, we type in a message that informs the user what they are expected to enter: Enter a date between 9/1/1986 and 9/1/1994 in the format: mm/dd/yyyy.

Validating Data Entry, Slide 38 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 39: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - error alert - 1

First, we click on the Error Alert tab to create a custom error message.

First, we click on the Error Alert tab to create a custom error message.

Second, we select the Stop style for the alert box.

Second, we select the Stop style for the alert box.

Third, we type in the title of the window in which the alert message appears, Enter Date of Birth.

Third, we type in the title of the window in which the alert message appears, Enter Date of Birth.

Fourth, we type in a message which tells the user what they should do to correct the error: Please enter a date between 9/1/1986 and 9/1/1994 in the format: mm/dd/yyyy.

Fourth, we type in a message which tells the user what they should do to correct the error: Please enter a date between 9/1/1986 and 9/1/1994 in the format: mm/dd/yyyy.

Fifth, we click on the OK button to conclude our data validation entries.

Fifth, we click on the OK button to conclude our data validation entries.

Validating Data Entry, Slide 39 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 40: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The input prompt for Date of Birth

Since cell D2 was selected when we entered the validation criteria, it now displays the input prompt which we specified.

Since cell D2 was selected when we entered the validation criteria, it now displays the input prompt which we specified.

If the box with the input prompt is covering the cell contents, move it to the right.

If the box with the input prompt is covering the cell contents, move it to the right.

Validating Data Entry, Slide 40 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 41: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Entering a correct Date of Birth

When we enter a correct date of birth, e.g. 3/5/1991, and press the Enter key, Excel checks our input against the validation criteria. If our entry satisfies the criteria, Excel accepts the entry and advances to the next entry.

When we enter a correct date of birth, e.g. 3/5/1991, and press the Enter key, Excel checks our input against the validation criteria. If our entry satisfies the criteria, Excel accepts the entry and advances to the next entry.

Validating Data Entry, Slide 41 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 42: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Entering an incorrect Date of Birth

When we enter an incorrect entry for date of birth, e.g. 12/15/2004 which is not in the acceptable range, Excel displays our Error Alert message.

When we enter an incorrect entry for date of birth, e.g. 12/15/2004 which is not in the acceptable range, Excel displays our Error Alert message.

We click on the Retry button and correct our entry.

We click on the Retry button and correct our entry.

If we were to click on the Cancel button, Excel undoes the data entry.

If we were to click on the Cancel button, Excel undoes the data entry.

Validating Data Entry, Slide 42 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 43: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Validation for placement date - usable range of dates

There can be a great deal of variability in the entries for date of placement, but we can set some broad conditions that would indicate an error in data entry.

First, if the date of placement entered was earlier than the child’s date of birth, it would clearly be an error. To prevent this error, we require that the date entry in column F, e.g. F2, is greater than column D, e.g. D2.

Similarly, if the date of placement entered was after the current date, it would clearly be an error. To prevent this error, we require that the date in column F, e.g. F2, is less than the current date, represented in Excel as the TODAY() function.

We will create a validation criteria to satisfy these conditions using a formula that refers to other cells in the list and the function that defines today’s date.

There can be a great deal of variability in the entries for date of placement, but we can set some broad conditions that would indicate an error in data entry.

First, if the date of placement entered was earlier than the child’s date of birth, it would clearly be an error. To prevent this error, we require that the date entry in column F, e.g. F2, is greater than column D, e.g. D2.

Similarly, if the date of placement entered was after the current date, it would clearly be an error. To prevent this error, we require that the date in column F, e.g. F2, is less than the current date, represented in Excel as the TODAY() function.

We will create a validation criteria to satisfy these conditions using a formula that refers to other cells in the list and the function that defines today’s date.

Validating Data Entry, Slide 43 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 44: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Using a formula for validation

First, select cells F2 through F5, which we will validate with the named list.

First, select cells F2 through F5, which we will validate with the named list.

Second, select Validation from the Data menu to open the Validation dialog box.

Second, select Validation from the Data menu to open the Validation dialog box.

Validating Data Entry, Slide 44 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 45: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 1

The settings tab of the data validation dialog box enables to set specifications for legal and illegal entries in the data field.

The settings tab of the data validation dialog box enables to set specifications for legal and illegal entries in the data field.

When we want to use a formula to test the values for data entry, we select Custom as the type of data to allow.

When we want to use a formula to test the values for data entry, we select Custom as the type of data to allow.

Validating Data Entry, Slide 45 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 46: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - settings - 2

First, we enter the response options as a reference to a named set of cells in the workbook, i.e. we type =AND(F2>D2, F2<=TODAY()).

The AND function links the two arguments that must both be true for the value of the formula to be true, i.e. the date in cell F2 must be greater, or after, the date in D2, and the date in D2 must be less than or equal to today’s date.

First, we enter the response options as a reference to a named set of cells in the workbook, i.e. we type =AND(F2>D2, F2<=TODAY()).

The AND function links the two arguments that must both be true for the value of the formula to be true, i.e. the date in cell F2 must be greater, or after, the date in D2, and the date in D2 must be less than or equal to today’s date.

Second, we mark the Ignore blank checkbox as we will treat blanks as missing data.

Second, we mark the Ignore blank checkbox as we will treat blanks as missing data.

Validating Data Entry, Slide 46 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 47: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - input message - 1

First, we click on the Input Message tab to navigate to that page.

First, we click on the Input Message tab to navigate to that page.

Second, we enter the title, Enter Placement Date which will be first line of the message, printed in bold.

Second, we enter the title, Enter Placement Date which will be first line of the message, printed in bold.

Third, we type in a message that informs the user what they are expected to enter: Enter a date of placement after the child's birthdate and prior to today in the format: mm/dd/yyyy.

Third, we type in a message that informs the user what they are expected to enter: Enter a date of placement after the child's birthdate and prior to today in the format: mm/dd/yyyy.

Validating Data Entry, Slide 47 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 48: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The data validation dialog - error alert - 1

First, we click on the Error Alert tab to create a custom error message.

First, we click on the Error Alert tab to create a custom error message.

Second, we select the Stop style for the alert box.

Second, we select the Stop style for the alert box.

Third, we type in the title of the window in which the alert message appears, Enter Placement Date.

Third, we type in the title of the window in which the alert message appears, Enter Placement Date.

Fourth, we type in a message which tells the user what they should do to correct the error: Please enter a date of placement after the child's birth date and prior to today in the format: mm/dd/yyyy.

Fourth, we type in a message which tells the user what they should do to correct the error: Please enter a date of placement after the child's birth date and prior to today in the format: mm/dd/yyyy.

Fifth, we click on the OK button to conclude our data validation entries.

Fifth, we click on the OK button to conclude our data validation entries.

Validating Data Entry, Slide 48 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 49: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

The input prompt for placement date

Since cell F2 was selected when we entered the validation criteria, it now displays the input prompt which we specified.

Since cell F2 was selected when we entered the validation criteria, it now displays the input prompt which we specified.

If the box with the input prompt is covering the cell contents, move it to the left.

If the box with the input prompt is covering the cell contents, move it to the left.

Validating Data Entry, Slide 49 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 50: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Entering a correct placement date

When we enter a correct date of placement, e.g. 7/15/2002, and press the Enter key, Excel checks our input against the validation criteria. If our entry satisfies the criteria, Excel accepts the entry and advances to the next entry.

When we enter a correct date of placement, e.g. 7/15/2002, and press the Enter key, Excel checks our input against the validation criteria. If our entry satisfies the criteria, Excel accepts the entry and advances to the next entry.

Validating Data Entry, Slide 50 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 51: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Entering an incorrect placement date - doesn't work

When we enter an incorrect entry for date of birth, e.g. 12/15/2004 which is not in the acceptable range, we would expect Excel to display the error message, but it does not.

The reason Excel does not display an error is because one of the cells referred to in the formula, D3, is blank. Excel does not enforce validation checking when one of the cells in a formula contains a blank.

When we enter an incorrect entry for date of birth, e.g. 12/15/2004 which is not in the acceptable range, we would expect Excel to display the error message, but it does not.

The reason Excel does not display an error is because one of the cells referred to in the formula, D3, is blank. Excel does not enforce validation checking when one of the cells in a formula contains a blank.

Validating Data Entry, Slide 51 Copyright © 2004, Jim Schwab, University of Texas at Austin

Page 52: Validating Data Entry The major issue in creating and using data bases, including Excel lists, is to assure that the information stored in the data base.

Entering an incorrect placement date does work

However, when we enter an incorrect entry for date of birth, e.g. 12/15/2004 which is not in the acceptable range in cell F2, on a row in which the date of birth is enter, the error checking works as expected.

However, when we enter an incorrect entry for date of birth, e.g. 12/15/2004 which is not in the acceptable range in cell F2, on a row in which the date of birth is enter, the error checking works as expected.

Validating Data Entry, Slide 52 Copyright © 2004, Jim Schwab, University of Texas at Austin