I am attempting to evenly distribute projects over a year so that the number of hours in each month are almost the same for each month. However, the projects are also assigned to a specific "domain" and can stretch over the course of multiple months. So, I am attempting to redistribute the projects over a year in a way that for each "domain" the sum of hours is as close to even as possible for each month. But if a project is originally from March to June (4 months) the project can be moved to August to November (4 months) but it can't be split up over non-sequential months.
The workflow/macros that I attached currently does what I am looking for, but it takes forever to run with my actual data which has 127,000 rows. I am hoping someone can help me optimize the macro, currently it is creating all possible combinations and narrowing it down from there, so it gets slower exponentially with every additional record.