Still not very clear. Can you post a sample workbook with the original input, and the expected output after the macro is run? And then explain what was the intended logic. Probably that should make it clear.