I attached an xls file in a rar file.
In the excel file are 4 sheets. The “products” sheet had productcode and options_cloned_from column.
For each productcode check the options1 and options2 sheets for rows containing the same code as options_cloned_from. Copy all those rows to the sample sheet. You can leave out the id column.
Then on the “sample” sheet, replace the “applytoproductcodes” with “productcode” from the products sheet. I did 5 samples for you on “sample” sheet. The first options_cloned_from row on products sheet was not on options1 or options2, so I skipped it.
If you find an options_cloned_from on the options1 sheet, no need to check options2, they don’t have same codes. I just had to split options into two sheets as it was to many rows for XLS file.