What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised...

21
ALS Management Information System Data Validation Manual (Updated on December 2015) Table of Contents WHAT IS DATA VALIDATION? 2 WHEN IS DATA VALIDATION USEFUL? 2 ENSURE YOUR SPREADSHEET IS READY 3 TO ACTIVATE THE DEVELOPER TAB IN RIBBON 3 TO ENABLE MACROS 3 DO NOT FORGET! 3 RENAME YOUR FILE 3 VALIDATION CRITERIA AND FORMULAS 4 RESTRICT TEXT LENGTH – FOR ALL TEXT CELLS 4 REQUIRE A UNIQUE 12-DIGIT NUMBER FOR LRN 4 REQUIRE WHOLE NUMBERS (NO DECIMAL) – FOR ZONE AND TYPE OF CLC 5 RESTRICT THE RANGE OF WHOLE NUMBERS FOR FLT SCORES 6 REQUIRE A SPECIFIC RANGE OF DATES - BIRTHDATES 8 REQUIRE THE FIRST LETTER OF EACH WORD TO BE CAPITALISED FOR ENTERED TEXT 8 THE TYPES OF DATA VALIDATION MESSAGES 10 INPUT MESSAGE 10 ERROR ALERT 10 THERE ARE 3 TYPES OF ERROR ALERTS 11 HOW TO CREATE AN ERROR ALERT? 11 ERROR ALERT MESSAGE FOR TEXT LENGTH 12 ERROR ALERT MESSAGE FOR REQUIRING A UNIQUE 12-DIGIT NUMBER 13 ERROR ALERT MESSAGE FOR REQUIRING WHOLE NUMBERS (NO DECIMAL) 13 ERROR ALERT MESSAGE FOR RESTRICTING THE RANGE OF WHOLE NUMBERS 14 ERROR ALERT MESSAGE FOR REQUIRING A RANGE OF DATES 14

Transcript of What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised...

Page 1: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

ALS Management Information SystemData Validation Manual

(Updated on December 2015)

Table of Contents

WHAT IS DATA VALIDATION? 2

WHEN IS DATA VALIDATION USEFUL? 2

ENSURE YOUR SPREADSHEET IS READY 3

TO ACTIVATE THE DEVELOPER TAB IN RIBBON 3 TO ENABLE MACROS 3

DO NOT FORGET! 3

RENAME YOUR FILE 3

VALIDATION CRITERIA AND FORMULAS 4

RESTRICT TEXT LENGTH – FOR ALL TEXT CELLS 4 REQUIRE A UNIQUE 12-DIGIT NUMBER – FOR LRN 4 REQUIRE WHOLE NUMBERS (NO DECIMAL) – FOR ZONE AND TYPE OF CLC 5 RESTRICT THE RANGE OF WHOLE NUMBERS – FOR FLT SCORES 6 REQUIRE A SPECIFIC RANGE OF DATES - BIRTHDATES 8 REQUIRE THE FIRST LETTER OF EACH WORD TO BE CAPITALISED – FOR ENTERED TEXT 8

THE TYPES OF DATA VALIDATION MESSAGES 10

INPUT MESSAGE 10 ERROR ALERT 10

THERE ARE 3 TYPES OF ERROR ALERTS 11

HOW TO CREATE AN ERROR ALERT? 11

ERROR ALERT MESSAGE FOR TEXT LENGTH 12 ERROR ALERT MESSAGE FOR REQUIRING A UNIQUE 12-DIGIT NUMBER 13 ERROR ALERT MESSAGE FOR REQUIRING WHOLE NUMBERS (NO DECIMAL) 13 ERROR ALERT MESSAGE FOR RESTRICTING THE RANGE OF WHOLE NUMBERS 14 ERROR ALERT MESSAGE FOR REQUIRING A RANGE OF DATES 14

Page 2: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

What is data validation?1

Data validation is an Excel feature that you can use to define restrictions on what data can or should be entered in a cell. You can configure data validation to prevent users from entering data that is not valid. If you prefer, you can allow users to enter invalid data but warn them when they try to type it in the cell. You can also provide messages to define what input you expect for the cell, and instructions to help users correct any errors.

When is data validation useful?2

Data validation is invaluable when you want to share a workbook with others in your organization, and you want the data entered in the workbook to be accurate and consistent.

Among other things, you can use data validation to do the following:

1. Restrict data to predefined items in a list    For example, you can limit types of departments to Sales, Finance, R&D, and IT. Similarly, you can create a list of values from a range of cells elsewhere in the worksheet.

2. Restrict numbers outside a specified range    For example, you can specify a minimum limit of deductions to two times the number of children in a particular cell.

3. Restrict dates outside a certain time frame    For example, you can specify a time frame between today's date and 3 days from today's date.

4. Restrict times outside a certain time frame     For example, you can specify a time frame for serving breakfast between the time when the restaurant opens and 5 hours after the restaurant opens.

5. Limit the number of text characters   For example, you can limit the allowed text in a cell to 10 or fewer characters. Similarly, you can set the specific length for a full name field (C1) to be the current length of a first name field (A1) and a last name field (B1), plus 10 characters.

6. Validate data based on formulas or values in other cells    

1 (Source: https://support.office.com/en-nz/article/Apply-data-validation-to-cells-c743a24a-bc48-41f1-bd92-95b6aeeb73c9)

2 (Source: https://support.office.com/en-nz/article/Apply-data-validation-to-cells-c743a24a-bc48-41f1-bd92-95b6aeeb73c9)

2

Page 3: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

For example, you can use data validation to set a maximum limit for commissions and bonuses of $3,600, based on the overall projected payroll value. If users enter more than $3,600 in the cell, they see a validation message.

Ensure your Spreadsheet is Ready

To make sure that the data validations are working on any spreadsheets, the users will have to show the Developer Tab in their ribbon and to ‘enable all macros’ in their settings.

To do so, please follow the instructions.

To activate the Developer Tab in Ribbon

1. Go to Office button on the top left corner2. Click on Excel Options on the bottom right corner3. In Popular: Top options for with Excel4. Tick the box for Show Developer tab in the Ribbon5. OK

Depending on your version of Microsoft, please follow these steps:1. Go to File on the top left corner2. Click on Options at the bottom 3. Customize Ribbon 4. Tick the box for Show Developer tab in the Ribbon5. OK

To enable macros

1. Go to Office button on the top left corner2. Click on Excel Options on the bottom right corner3. In Trust Centre: Under Microsoft Office Excel Trust Centre, click on the Trust

Centre Settings button4. In Macro Settings: select Enable all macros (not recommended; potentially

dangerous code can run)

Depending on your version of Microsoft, please follow these steps:1. Go to File on the top left corner2. Click on Options at the bottom 3. In Trust Centre: Under Microsoft Office Excel Trust Centre, click on the Trust

Centre Settings button4. In Macro Settings: select Enable all macros (not recommended; potentially

dangerous code can run)

Do not forget! Save the change and close the spreadsheet and open it again for have access to your new set ups.

3

Page 4: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Rename your filePlease see below how your file should be renamed:YYYY(space)MIS(space)District(space)Designation(space)SurnameExample: 2015 MIS Pili MT Pagaran

Validation Criteria and Formulas

Restrict text length – For all text cells

1. Select one or more cells to validate2. Go to the Data tab3. On the Data tab, in the Data Tools group, click on Data Validation4. In the Data Validation dialog box, find Settings5. In Settings, provide Validation Criteria (see as follows)

4

Page 5: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Allow: Text lengthData: BetweenMinimum: 1Maximum: 20Click Ok

Always unselect the Ignore blank

box!!

5

Page 6: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Require a unique 12-digit number – for LRN

Select one or more cells to validateGo to the Data tabOn the Data tab, in the Data Tools group, click on Data ValidationIn the Data Validation dialog box, find SettingsIn Settings, provide Validation Criteria (see as follows)

6

Page 7: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Allow: CustomFormula: =AND(LEN(L2)=12,ISNUMBER(L2))

Please note: Enter this formula for the first cell of the column (here, cell L2). Select the cell in your workbook and drag the selected cell along the rest of the column.

Always unselect the Ignore blank

box!!

7

Page 8: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Require whole numbers (no decimal) – For Zone and Type of CLC

1. Select one or more cells to validate2. Go to the Data tab3. On the Data tab, in the Data Tools group, click on Data Validation4. In the Data Validation dialog box, find Settings5. In Settings, provide Validation Criteria (see as follows)

8

Page 9: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Allow: Whole numberData: betweenMinimum: 1Maximum: 7 (or 4 for Type of CLC)OK

Always unselect the Ignore blank

box!!

9

Page 10: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Restrict the range of whole numbers – for FLT scores

1. Select one or more cells to validate2. Go to the Data tab3. On the Data tab, in the Data Tools group, click on Data Validation4. In the Data Validation dialog box, find Settings5. In Settings, provide Validation Criteria (see as follows)

10

Page 11: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Allow: Whole numberData: betweenMinimum: 0Maximum: 100OK

Always unselect the Ignore blank

box!!

11

Page 12: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Require a specific range of dates - Birthdates

1. Select one or more cells to validate2. Go to the Data tab3. On the Data tab, in the Data Tools group, click on Data Validation4. In the Data Validation dialog box, find Settings5. In Input Message, type your message (see as follows)

Require the first letter of each word to be capitalised – for entered text

NOTE: Please note that this is not a data validation rule but a code applied here.1. Select one 2. Go to the Developer tab3. On the Developer tab, in the Visual Basic group, click on Editor4. Double-click on Sheet you are working on5. Select Worksheet in the first drop-down (top left corner)6. Select Change in the second drop-down (top right corner)7. Write your code on the blank space (see as follows)

12

Page 13: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Code: Private Sub Worksheet_Change(ByVal Target As Range)

'Forces text to Proper case for the range D2:D50

If Target.Cells.Count > 1 Or Target.HasFormula Then Exit Sub

On Error Resume Next

If Not Intersect(Target, Range("D2:D50")) Is Nothing Then

Application.EnableEvents = False

Target = StrConv(Target, vbProperCase)

Application.EnableEvents = True

End If

On Error GoTo 0End Sub

13

Page 14: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

To learn how to type this code into the Visual Basic Editor, please watch this Youtube video: https://www.youtube.com/watch?v=7RVGdA9AhrY&list=PLNIs-AWhQzckr8Dgmgb3akx_gFMnpxTN5&index=2

No need to develop an Error Alert Message as the entered data will be automatically changed to the correct text format (as set up by the code).

Please be aware that you cannot simply copy and paste the piece of code from this document for it to work on your Excel spreadsheet. You will have to type the

code into the Visual Basic Editor window.

The Types of Data Validation Messages

What users see when they enter invalid data into a cell depends on how you have configured the data validation.

Input Message

You can choose to show an input message when the user selects the cell. This type of message appears near the cell. You can move this message, if you want to, and it remains until you move to another cell or press ESC.

Input messages are generally used to offer users guidance about the type of data that you want entered in the cell.

Error Alert

You can also choose to show an error alert that appears only after users enter invalid data.

14

Page 15: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

There are 3 types of error alerts

Icon Type Use to

Stop Prevent users from entering invalid data in a cell. A Stop alert message has two options: Retry or Cancel.

Warning Warn users that the data they entered is invalid, without preventing them from entering it. When a Warning alert message appears, users can click Yes to accept the invalid entry, No to edit the invalid entry, or Cancel to remove the invalid entry.

Information Inform users that the data they entered is invalid, without preventing them from entering it. This type of error alert is the most flexible. When an Information alert message appears, users can click OK to accept the invalid value or Cancel to reject it.

You can customize the text that users see in an error alert message. If you choose not to do so, users see a default message.

How to create an Error Alert?

1. Select one or more cells to validate2. Go to the Data tab3. On the Data tab, in the Data Tools group, click on Data Validation

15

Page 16: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

4. In the Data Validation dialog box, click Input Message5. In Input Message, unselect the automatically selected Show input message when cell is selected

1. Go to Error Alert, select Show error alter after invalid data is entered2. Select the Style, Stop3. Enter a Title and an Error message (see example below)

Error Alert Message for Text Length

16

Page 17: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Error Alert Message for Requiring a Unique 12-Digit Number

17

Page 18: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Error Alert Message for Requiring Whole Numbers (No Decimal)

Error Alert Message for Restricting the Range of Whole Numbers

18

Page 19: What is data validation?€¦  · Web viewRequire the first letter of each word to be capitalised – for entered text. NOTE: Please note that this is not a data validation rule

Error Alert Message for Requiring a Range of Dates

19