I have two columns. I want to replace data in Column with randomly selected data from Column. However I need to ensure that same string in Column 1 is replaced with the same string in Column 2. For e.g.
Table 1:
Backup Software
Word Processor
Backup Software
Anti-virus
Anti-virus
Backup Software
Table 2:
Cat
Dog
Fish
The result should be:
Fish
Dog
Fish
Cat
Cat
Fish
Notice that Backup Software is replaced with randomly select item “Fish”. Anti-virus is replaced by Cat. And Wordprocessor is replaced by Dog
I am using a Dictionary based Cell-replacement strategy for this. But it is rather cumbersome when dealing with large amount of data and columns.
in your example you happen to have the same number of unique values in both tables, is this a general assumption you can make? If so, then you could use the following strategy:
Apply Group By to Table 1 to get the unique values.
Hello @nemad and @Iris. Thanks for the feedback. I am currently using the strategy that you suggested (using dictionary based cell-replacer). But it becomes very complex when the number of columns that need to be replaced increases. I was looking for a simpler solution.
For multiple columns, you can use the Column List Loop Start and Loop End (Column Append) to apply the same technique to all of your columns.
Admittedly, this is slightly more complicated but once you got it set up, you can deal with arbitrary many columns.