The "Copy rows selectively" instruction can be used to copy rows from a data range, depending on a value(s) located in a specified column(s).
One simple scenario where this instruction could be useful is when a we want to copy only the details of employees belonging to a certain department, as shown in the below example data set.
For example, we'd like to copy only the details of employees in the Marketing department into the next sheet in the workbook.
Suppose for this example, the original data set lies in the "Sheet1" worksheet and we desire the output data set in "Sheet2".
2. Create an action step to manipulate data.
3. Select the "Copy rows selectively" instruction.
4. Configure the source range to select the data set.
5. Set the target range to the desired location (in our case, in Sheet2).
6. Enter the condition on which a row will be copied over and click "Add"
In the following example rows will be copied on the condition that the value in column A equals 'Marketing' (note that the condition is selected to be case sensitive).
7. In the case of multiple conditions, select whether you want ALL or ANY of the conditions to be met for the rows to be copied.
- ALL: all conditions you enter must be satisfied for the row to be copied over
- ANY: at least one condition you enter must be satisfied for the row to be copied over
In the following example, two conditions are specified and we choose to meet "ALL" the conditions for the row to be copied over:
8. Click "SAVE" and run the step.
Once this step completes successfully, the appropriate rows will have been copied over to the target range (Sheet2 in our example).
Useful tips and resources
- The conditions in step 6 can be generalised into more than an "equals to" operator. For example, we can use a wide range of various operators including the below options.
- Users can choose to fix their conditional value (select "Literal") or set it to vary depending on a property elsewhere in the process (select "Data Property Link").
- For those who select "Data Property Link", instead of writing a literal value in the text box, you can link the value to a data property that contains a variable value
The file containing the example used in this article can be downloaded below.