If this was not the result you want, I apologize. At that time, in order to correctly understand your situation, can you provide a sample Spreadsheet for replicating your situation? By this, I would like to modify the script.