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 1Copyright © 2004, Jim Schwab, University of Texas at Austin
Validating a numeric entry 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. 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. Validating Data Entry, Slide 2Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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 3Copyright © 2004, Jim Schwab, University of Texas at Austin
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 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 4Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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 5Copyright © 2004, Jim Schwab, University of Texas at Austin
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 6Copyright © 2004, Jim Schwab, University of Texas at Austin
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. Validating Data Entry, Slide 7Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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 8Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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 9Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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. The 'Title' and 'Error message' text boxes contain the text of the feedback to the user. Validating Data Entry, Slide 10Copyright © 2004, Jim Schwab, University of Texas at Austin
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. If the box with the input prompt is covering the cell contents, move it to the right. Validating Data Entry, Slide 11Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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 12Copyright © 2004, Jim Schwab, University of Texas at Austin
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. We click on the Retry button and correct our entry. If we were to click on the Cancel button, Excel undoes the data entry. Validating Data Entry, Slide 13Copyright © 2004, Jim Schwab, University of Texas at Austin
The corrected ID Number We correct the ID number to 1002, which Excel accepts and moves to the next row. Validating Data Entry, Slide 14Copyright © 2004, Jim Schwab, University of Texas at Austin
Entering another incorrect ID Number When we enter an incorrect number for ID with a decimal fractions, e.g , Excel displays our Error Alert message. We click on the Retry button and correct our entry. If we were to click on the Cancel button, Excel undoes the data entry. Validating Data Entry, Slide 15Copyright © 2004, Jim Schwab, University of Texas at Austin
The corrected ID Number We correct the ID number to 1003, which Excel accepts and moves to the next row. Validating Data Entry, Slide 16Copyright © 2004, Jim Schwab, University of Texas at Austin
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 Validation from the Data menu to open the Validation dialog box. Validating Data Entry, Slide 17Copyright © 2004, Jim Schwab, University of Texas at Austin
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 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 18Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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 19Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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. 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 20Copyright © 2004, Jim Schwab, University of Texas at Austin
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. If the box with the input prompt is covering the cell contents, move it to the right. Validating Data Entry, Slide 21Copyright © 2004, Jim Schwab, University of Texas at Austin
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. We highlight our choice from the drop down menu. When we release the mouse button, Excel fills in the cell with our choice. Validating Data Entry, Slide 22Copyright © 2004, Jim Schwab, University of Texas at Austin
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. Click on Retry and correct the entry. Validating Data Entry, Slide 23Copyright © 2004, Jim Schwab, University of Texas at Austin
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 24Copyright © 2004, Jim Schwab, University of Texas at Austin
Entering a list of codes Validating Data Entry, Slide 25Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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. Validating Data Entry, Slide 26Copyright © 2004, Jim Schwab, University of Texas at Austin
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. Validating Data Entry, Slide 27Copyright © 2004, Jim Schwab, University of Texas at Austin
Using ConservatorCodes for validation 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. Validating Data Entry, Slide 28Copyright © 2004, Jim Schwab, University of Texas at Austin
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 acceptable entries for Conservator are the list of ConservatorCodes. Select List as the type of data to allow. Validating Data Entry, Slide 29Copyright © 2004, Jim Schwab, University of Texas at Austin
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. Validating Data Entry, Slide 30Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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. 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 31Copyright © 2004, Jim Schwab, University of Texas at Austin
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. If the box with the input prompt is covering the cell contents, move it to the right. Validating Data Entry, Slide 32Copyright © 2004, Jim Schwab, University of Texas at Austin
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. We highlight our choice from the drop down menu. When we release the mouse button, Excel fills in the cell with our choice. Validating Data Entry, Slide 33Copyright © 2004, Jim Schwab, University of Texas at Austin
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, The acceptable range of dates for my list is, therefore, between September 1, 1986 and September 1, 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, The acceptable range of dates for my list is, therefore, between September 1, 1986 and September 1, 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 34Copyright © 2004, Jim Schwab, University of Texas at Austin
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 Validation from the Data menu to open the Validation dialog box. Validating Data Entry, Slide 35Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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 36Copyright © 2004, Jim Schwab, University of Texas at Austin
The data validation dialog - settings - 2 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. 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. Validating Data Entry, Slide 37Copyright © 2004, Jim Schwab, University of Texas at Austin
The data validation dialog - input message - 1 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. 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 38Copyright © 2004, Jim Schwab, University of Texas at Austin
The data validation dialog - error alert - 1 First, we click on the Error Alert tab to create a custom error message. 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. 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. Validating Data Entry, Slide 39Copyright © 2004, Jim Schwab, University of Texas at Austin
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. If the box with the input prompt is covering the cell contents, move it to the right. Validating Data Entry, Slide 40Copyright © 2004, Jim Schwab, University of Texas at Austin
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. Validating Data Entry, Slide 41Copyright © 2004, Jim Schwab, University of Texas at Austin
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. We click on the Retry button and correct our entry. If we were to click on the Cancel button, Excel undoes the data entry. Validating Data Entry, Slide 42Copyright © 2004, Jim Schwab, University of Texas at Austin
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 43Copyright © 2004, Jim Schwab, University of Texas at Austin
Using a formula for validation 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. Validating Data Entry, Slide 44Copyright © 2004, Jim Schwab, University of Texas at Austin
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. 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 45Copyright © 2004, Jim Schwab, University of Texas at Austin
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. Validating Data Entry, Slide 46Copyright © 2004, Jim Schwab, University of Texas at Austin
The data validation dialog - input message - 1 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. 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 47Copyright © 2004, Jim Schwab, University of Texas at Austin
The data validation dialog - error alert - 1 First, we click on the Error Alert tab to create a custom error message. 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. 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. Validating Data Entry, Slide 48Copyright © 2004, Jim Schwab, University of Texas at Austin
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. If the box with the input prompt is covering the cell contents, move it to the left. Validating Data Entry, Slide 49Copyright © 2004, Jim Schwab, University of Texas at Austin
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. Validating Data Entry, Slide 50Copyright © 2004, Jim Schwab, University of Texas at Austin
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 51Copyright © 2004, Jim Schwab, University of Texas at Austin
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. Validating Data Entry, Slide 52Copyright © 2004, Jim Schwab, University of Texas at Austin