Hiding columns selectively
The [highlight txt=’hide columns selectively’] instruction allows a user to hide columns from within a Excel worksheet based on the data contained in a row or in various rows across each of the selected columns. For example, a user can configure the instruction to hide any columns from ColumnA to ColumnG if the numbers in the first row of the columns are greater than 10.[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 looks like this:
1. Create a ‘Hide columns selectively’ instruction.
2. Link the file named “Target” as the target file.
3. Select Sheet1.
4. Use an Advanced Range from A1 to the last cell in ColumnA as far as D.
5. Type into the Row field or adjust the ticker next to this field to “1”.
6. Set the variable condition to “greater than”. (This can be done by clicking on the field to the right of the Row field, which should by default be set to “equals”. Clicking on this field will open up a dropdown. Select “greater than” from this dropdown). This variable condition can then be matched to a value.
7. Type “10” 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.
8. Save and run the step.
9. After the step finishes running, download and open the target file. As you can see, ColumnC and ColumnD have been hidden because the values in the first row of those columns were greater than 10: