Forum Discussion
need cells combination of cells that will follow 2 conditions rules
I can't thank you enough for your immediate support.
The point here is the following:
I insert 10 values for the lengths of the cars.
Excel provides me the combinations as follows:
eg PUT CAR 1 +CAR 5+CAR3+CAR 9+ CAR10 together as the total length is less than 1900
and, at the same time, because the rest of the cars CAR 2 +CAR 4+CAR 6 +CAR7 +CAR8 have a sum of length also less than 1900. So group 1 could go upper level and the other goes down.
The issue here is not to calculate the sum, but create automatically two groups of cars that won't exceed the max length given. In the end, i have all the combinations of car groups, which would both have a limited total length.
My next step would be to check if the upper level car and ground level car, dont' exceed the maximum height. But, that is easier. I already have a solution of the height.
Hi paranoir1986,
I wrote a VBA macro for you.
Don't touch the blue cells. They will be automatically populated when you run the code.
If your max length (cell C2) suddenly turns red, don't bother, it's mathematically impossible to fit your 10 cars.
This will only populate the first row but I hope you'll figure out that the remaining cars goes on the second row.