The [highlight txt=’match list’] instruction allows a user to compare one cell range with another cell range. In a sense, this instruction is quite similar to the [highlight txt=’compare range’] instruction. However, the [highlight txt=’match list’] instruction is able to analyse the two ranges (individually, and in comparison with each other) to then generate a ‘diagnostics’ worksheet (inserted to the end of the target file) which summarises these analyses. More specifically, this ‘diagnostics’ worksheet will show: the number of items found in source list,the number of items found in target list,the number of items found only in source list,the number of items found only in target list,the number of items found in both lists. The values of what was found only in the source list, of what was found only in the target list, and of what was found in both lists, will also be displayed.[message type=”warning”]For the purposes of this article we are going to use two simple and fictitious Excel files. They have already been uploaded into a data step. You will want to replace these files with those 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 source file that we are going to use looks like this:
The target file that we are going to use looks like this:
We can see that the two files are identical in every way except that cell A5 in the source file contains the value “5,” whereas cell A5 in the target file contains the value “E”.
1. Create a ‘Compare range’ instruction.
2. Link the file named “Source” as the source file and the file named “Target” as the target file.
3. Select Sheet1 from both files.
4. For both files, use an Advanced Range from cell A1 to the last cell in ColumnA as far as A.
5. The ‘Name of worksheet for results’ field should be populated with “List Matching Results” by default. Change this to “Diagnostics”.
6. Save and run the step.
7. After the step finishes running, download and open the target file. It will resemble the image below: