need cells combination of cells that will follow 2 conditions rules

%3CLINGO-SUB%20id%3D%22lingo-sub-1723085%22%20slang%3D%22en-US%22%3Eneed%20cells%20combination%20of%20cells%20that%20will%20follow%202%20conditions%20rules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1723085%22%20slang%3D%22en-US%22%3E%3CP%3Ei%20have%2010%20cars%20that%20need%20to%20fit%20in%20a%20car%20transporter%20truck.%20I%20have%20a%20limit%20on%20the%20length%20of%20the%20truck%2C%20which%20can%20take%205%20cars%20in%20upper%20level%20and%20the%20rest%205%20in%20ground%20level.%20i%20need%20a%20formula%20that%20will%20take%20the%2010%20car%20lengths%20and%20give%20me%20all%20possible%205%20car%20combinations%20that%20dont%20exceed%20the%20truck%20length%20limit%2C%20while%20the%20rest%205%20cars%20will%20also%20not%20exceed%20the%20length%20limit.%3C%2FP%3E%3CP%3Eappreciate%20your%20help%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1723085%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1725066%22%20slang%3D%22en-US%22%3ERe%3A%20need%20cells%20combination%20of%20cells%20that%20will%20follow%202%20conditions%20rules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1725066%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F812911%22%20target%3D%22_blank%22%3E%40paranoir1986%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eyou%20can%20easily%20use%20solver%3C%2FP%3E%3CP%3EI%20have%20set%20up%20the%20model%20for%20you%3C%2FP%3E%3CP%3Ejust%20change%20the%20car%20lengths%3C%2FP%3E%3CP%3Ethen%20go%20to%20data%20--%26gt%3B%20solver%20--%26gt%3B%20optimize%3C%2FP%3E%3CP%3Eif%20you%20did%20not%20add%20solver%2C%20add%20it%2C%20see%20how%20to%20do%20it%20using%20youtube%3C%2FP%3E%3CP%3Ehope%20it%20is%20clear%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726071%22%20slang%3D%22de-DE%22%3ESubject%3A%20need%20cells%20combination%20of%20cells%20that%20will%20follow%202%20conditions%20rules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726071%22%20slang%3D%22de-DE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F812911%22%20target%3D%22_blank%22%3E%40paranoir1986%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22tlid-translation%20translation%22%3E%3CSPAN%20class%3D%22%22%3EHere%20is%20a%20small%20proposal%20for%20a%20solution%20...%20very%20simple%20but%20clear.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22tlid-translation%20translation%22%3E%3CSPAN%20class%3D%22%22%3EIf%20I%20can%20recommend%20you%2C%20add%20a%20file%20(without%20sensitive%20data)%20and%20explain%20your%20plan%20by%20adding%20something%20to%20your%20question%20in%20the%20file.%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22tlid-translation%20translation%22%3E%3CSPAN%20class%3D%22%22%3EThis%20means%20that%20you%20can%20be%20helped%20faster%20and%20more%20accurately%20and%20it%20is%20made%20easier%20for%20the%20helpers%20to%20offer%20you%20a%20tailor-made%20solution.%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20I%20was%20able%20to%20help%20you%20and%20would%20be%20happy%20to%20know%20if%20I%20could%20help%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%3E*%20Kindly%20Mark%20and%20Vote%20this%20reply%20if%20it%20helps%20please%2C%20as%20it%20will%20be%20beneficial%20to%20more%20community%20members%20reading%20here.%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726318%22%20slang%3D%22en-US%22%3EBetreff%3A%20need%20cells%20combination%20of%20cells%20that%20will%20follow%202%20conditions%20rules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726318%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40Nikolino%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20for%20your%20proposal.%3C%2FP%3E%3CP%3EActually%2C%20the%20transportation%20truck%20can%20take%205%20cars%20at%20the%20upper%20level%20and%20the%20rest%205%20at%20ground%20level.%3C%2FP%3E%3CP%3EEvery%20level%20has%20a%20limit%20of%2019%20meters%20length%20in%20car%20load.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETherefore%20i%20need%20a%20formula%20that%20will%20identify%20all%205%20car%20(out%20of%2010)%20combinations%20that%20will%20have%20a%20maximum%20sum%20of%201900%20(19meters%20shown%20in%20centimeters)%20in%20order%20to%20fill%20upper%20level%20for%20example%2C%20while%20at%20the%20same%20time%2C%26nbsp%3B%20the%20rest%205%20will%20also%20have%20(as%20group%202)%20a%20maximum%20sum%20of%201900%20in%20order%20to%20fill%20ground%20level.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20my%20opinion%2C%20its%20pretty%20clear%20as%20a%20thought%2C%20but%20can't%20get%20close%20to%20a%20solution%20as%20far%20as%20excel%20programming%20is%20concerned.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726473%22%20slang%3D%22de-DE%22%3ESubject%3A%20need%20cells%20combination%20of%20cells%20that%20will%20follow%202%20conditions%20rules%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726473%22%20slang%3D%22de-DE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F812911%22%20target%3D%22_blank%22%3E%40paranoir1986%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20be%20happy%20to%20know%20if%20I%20could%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%222%22%3E*%20Kindly%20Mark%20and%20Vote%20this%20reply%20if%20it%20helps%20please%2C%20as%20it%20will%20be%20beneficial%20to%20more%20community%20%3C%2FFONT%3Emembers%20reading%20%3CFONT%20size%3D%222%22%3Ehere.%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

i have 10 cars that need to fit in a car transporter truck. I have a limit on the length of the truck, which can take 5 cars in upper level and the rest 5 in ground level. i need a formula that will take the 10 car lengths and give me all possible 5 car combinations that dont exceed the truck length limit, while the rest 5 cars will also not exceed the length limit.

appreciate your help

8 Replies
Highlighted

@paranoir1986 

 

you can easily use solver

I have set up the model for you

just change the car lengths

then go to data --> solver --> optimize

if you did not add solver, add it, see how to do it using youtube

hope it is clear

Highlighted

@paranoir1986 

 

Here is a small proposal for a solution ... very simple but clear.

 

If I can recommend you, add a file (without sensitive data) and explain your plan by adding something to your question in the file.

This means that you can be helped faster and more accurately and it is made easier for the helpers to offer you a tailor-made solution.

 

Hope I was able to help you and would be happy to know if I could help you.

 

Nikolino

I know I don't know anything (Socrates)

 

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.

Highlighted

@Nikolino 

 

Thank for your proposal.

Actually, the transportation truck can take 5 cars at the upper level and the rest 5 at ground level.

Every level has a limit of 19 meters length in car load.

 

Therefore i need a formula that will identify all 5 car (out of 10) combinations that will have a maximum sum of 1900 (19meters shown in centimeters) in order to fill upper level for example, while at the same time,  the rest 5 will also have (as group 2) a maximum sum of 1900 in order to fill ground level. 

 

In my opinion, its pretty clear as a thought, but can't get close to a solution as far as excel programming is concerned. 

Highlighted

@paranoir1986 

 

I would be happy to know if I could help.

 

Nikolino

I know I don't know anything (Socrates)

 

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.

Highlighted

@Nikolino 

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.

Highlighted

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.

Highlighted

I forgot to attach the file

please check it

Highlighted

@paranoir1986 

 

It is not quite finished (sry no more time) but with this you can fill the first level and the second level would be the rest.
However you look at yourself, if that comes closer to your ideas, we can continue from there.
It is of course VBA is also a possibility, like Mr. Ramiz_Assaf  sent you with a wonderful example.

There are many ways that lead to Rome, so there are many ways to the solution with Excel
 

Sorry that I took your time and couldn't give you a quick solution.

 

Wish you a nice day.

 

Nikolino

I know I don't know anything (Socrates)