Validating cells in a worksheet
The [highlight txt=’validate cells in workbook’] instruction allows a user to check a cell range against a condition or multiple conditions.[message type=”warning”]For the purposes of this article we are going to use a simple and fictitious Excel file. It has already been uploaded into a data step. You will want to replace this file with one of your own.[/message]
Before we get started
Please further create a ‘Manipulate a file’ or ‘Multiple file manipulations’ action step so that you can add and use instructions.
The target file that we are going to use resembles the following image.
1. Create an ‘Validate cells in workbook’ instruction.
2. Link the file named “Target” as the target file.
3. Use Sheet1 from the target file.
4. Use an Advanced Cell Range from cell A1 to cell A5.
5. The rule for ‘Minimum number of conditions to pass’ is set to “1” by default.
6. Type “A” in the Column field under the ‘Set conditions’ section.
7. Set the variable condition to “less than”. (This can be done by clicking on the field to the right of the Column field, which should by default be set to “equals”. Clicking on this field will open up a dropdown. Select “less than” from this dropdown). This variable condition can then be matched to a value.
8. Type “5” into the Value field. This field is located to the immediate right of the variable condition. This field should contain the word “value” in italics by default, though the word only serves as an indicator, thus is nothing is entered into the field, the field will be treated as empty (instead of as being populated by the word “value”). The Value field can also be treated with sensitivity to case. It can also be linked to a data property existing elsewhere in the process.
5. Save and run the step.
6. The step will fail. This is because cell A5 contains the value “5,” which is not less than 5, and therefore will did not satisfy the condition configured into the instruction. The following error message will be shown: