I’m trying to match up data between two excel files. In Book 1 I have a list of Companies Names that i want to indicate if they appear in the Companies Name list in Book 2.
If there is a match then in Book 1 on column B a “Y” should be recorded. If there is no match a “N” should be recorded.
Further it should take account of variations between Ltd or Limited. So that if in Book 1 a Company is called “Company 2 Limited” the process should still match it up with “Company 2 Ltd” in Book 2. The same will also be true if in Book 1 a Company is called “Company 3 Ltd” the process should still match it up with “Company 3 Limited” in Book 2.
I can setup the data tables and the variables but get stuck when it comes to the actual comparison. I have started with a For Each Row Activity for dtBook1 and inside another For Each Row Activity for dtBook2. I’ve then added an If Activity to compare the two Company Name strings. I’m unsure where to go from here though.
I’ve done a similar thing recently using the following steps:
Read in both spreadsheets as separate data tables
add a new column to DT1 to handle the match status
use a for each row on DT1 and inside it filter DT2 by the company name of the current row.
Use an if statement to see if DT2.rows.count > 0. If it is then there is a match and update the new column with a Y. If no match then move on to the next row in DT1
For the actual name comparison in the filter, you could do a wildcard search for “Company 2 *” which will match both Limited, Ltd, LTD. and any other permutations. Just replace all instances of limited or ltd with the * wildcard
Thanks Andy, i’ve added in as suggested. The workflow runs but the original excel is not being updated. I think i am doing something wrong in the Filter Data Table activity.
I can’t open most of your workflows as we are running different versions of the Studio. One thing I did notice was that you use a write cell activity looking at cell F1, is that the only place you are writing an output? If so, it will only ever update that specific cell in the spreadsheet
It may be an issue with your filter then, pop some log messages in to display the number of rows in the DT or use a write range to output it to a new, blank spreadsheet to see what the filter is doing