How to find best combinations in Excel

%3CLINGO-SUB%20id%3D%22lingo-sub-1518064%22%20slang%3D%22en-US%22%3EHow%20to%20find%20best%20combinations%20in%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1518064%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20There%2C%3C%2FP%3E%3CP%3EI%20have%20a%20complex%20problem%20that%20can%20be%20solved%20by%20nested%20loops%2C%20which%20means%20programming%20skills%20which%20I%20am%20not%20equipped%20with%20at%20this%20point%2C%20but%20I%20thought%20you%20might%20have%20a%20suggestion%20on%20how%20to%20use%20Excel%20to%20solve%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20the%20problem%3A%3C%2FP%3E%3CP%3EThere%20is%20a%20span%20of%2020%20m%20which%20has%20to%20be%20filled%20with%20the%20prefabricated%20elements%20with%20standard%20spans%20of%203m%2C%204.2m%2C%20and%205m.%20I%20need%20to%20find%20out%20about%20the%20best%20combination%20of%20the%20standard%20elements%20which%20gives%20the%20least%20leftover.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20do%20appreciate%20your%20help%20and%20time%20in%20advance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20Regards%2C%3C%2FP%3E%3CP%3EFarshid%20Kaviani%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1518064%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1518859%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20find%20best%20combinations%20in%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1518859%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F726614%22%20target%3D%22_blank%22%3E%40FarshidKaviani%3C%2FA%3E%26nbsp%3BPerhaps%20the%20attached%20schedule%20can%20help%20you%20resolve%20your%20problem%2C%20or%20at%20least%20give%20you%20an%20idea%20re%20how%20to%20approach%20its%20solution.%20Enter%20the%20span%20and%20maximum%20tolerated%20waste%20at%20the%20top%20and%20in%20the%20matrix%20below%2C%20you'll%20see%20green%20numbers%20for%20exact%20matches%20and%20red%20ones%20for%20those%20that%20fall%20below%20the%20accepted%20waste.%20If%20it's%20not%20at%20all%20useful%2C%20kindly%20disregard.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1519978%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20find%20best%20combinations%20in%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1519978%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F726614%22%20target%3D%22_blank%22%3E%40FarshidKaviani%3C%2FA%3E%26nbsp%3B%2C%20As%20a%20variation%20to%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3B's%20solution%2C%20you%20can%20use%20the%20Sover%20add-in%20to%20solve%20this%20problem.%20Here%20I'm%20setting%20the%20problem%20up%20to%20have%20a%20solution%20that%20the%20length%20is%20less%20than%2020%20with%20all%203%20lengths%20to%20be%20used%20and%20be%20integers.%20You%20can%20adjust%20the%20constraints%20and%20play%20around%20with%20the%20type%20of%20solution%20you%20need.%20Hope%20this%20helps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22TheAntony_0-1594678628404.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F205114i39FF179AECF2CCE3%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22TheAntony_0-1594678628404.png%22%20alt%3D%22TheAntony_0-1594678628404.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%20border%3D%220%22%20width%3D%22268%22%20cellspacing%3D%220%22%20cellpadding%3D%220%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%2267%22%20height%3D%2219%22%3EElements%3C%2FTD%3E%3CTD%20width%3D%2267%22%3E3%3C%2FTD%3E%3CTD%20width%3D%2267%22%3E4.2%3C%2FTD%3E%3CTD%20width%3D%2267%22%3E5%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2219%22%3ECount%3C%2FTD%3E%3CTD%3E2%3C%2FTD%3E%3CTD%3E2%3C%2FTD%3E%3CTD%3E1%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2219%22%3ESpan%3C%2FTD%3E%3CTD%3E19.4%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1520385%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20find%20best%20combinations%20in%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1520385%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3BThank%20you%20so%20much%20for%20your%20effort.%20I%20was%20looking%20for%20an%20automatic%20solution%20that%20does%20not%20involve%20so%20many%20manual%20data%20entries%20since%20the%20standard%20spans%20cover%20quite%20a%20wide%20range%2C%20but%20I%20found%20your%20solution%20very%20useful%20for%20optimizing%20the%20waste%20optimization%20which%20is%20equally%20important%20in%20my%20project.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20do%20appreciate%20your%20help!%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EFarshid%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1520424%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20find%20best%20combinations%20in%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1520424%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F383224%22%20target%3D%22_blank%22%3E%40TheAntony%3C%2FA%3E%26nbsp%3BThank%20you%20so%20much%20for%20your%20help.%20I%20managed%20to%20solve%20the%20problem%20using%20your%20method%20but%20since%20the%20standard%20span%20of%20elements%20covers%20a%20wide%20range%20so%20I%20do%20appreciate%20any%20other%20suggestions%20that%20can%20take%20a%20range%20of%20numbers%20as%20standard%20element%20sizes.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20appreciate%20your%20time%20and%20help!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EFarshid%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1522288%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20find%20best%20combinations%20in%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1522288%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F726614%22%20target%3D%22_blank%22%3E%40FarshidKaviani%3C%2FA%3E%26nbsp%3B%2C%20You%20can%20set%20the%20constraints%20as%20ranges%20instead%20of%20individual%20cells.%20See%20example.%20Hope%20that%20helps.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1522716%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20find%20best%20combinations%20in%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1522716%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F383224%22%20target%3D%22_blank%22%3E%40TheAntony%3C%2FA%3E%26nbsp%3BThank%20you%20so%20much.%20That%20works%20perfectly!!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1525439%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20find%20best%20combinations%20in%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1525439%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F726614%22%20target%3D%22_blank%22%3E%40FarshidKaviani%3C%2FA%3E%26nbsp%3B%2C%20Glad%20it%20helped!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi There,

I have a complex problem that can be solved by nested loops, which means programming skills which I am not equipped with at this point, but I thought you might have a suggestion on how to use Excel to solve that.

 

Here is the problem:

There is a span of 20 m which has to be filled with the prefabricated elements with standard spans of 3m, 4.2m, and 5m. I need to find out about the best combination of the standard elements which gives the least leftover.

 

I do appreciate your help and time in advance.

 

Best Regards,

Farshid Kaviani

7 Replies

@FarshidKaviani Perhaps the attached schedule can help you resolve your problem, or at least give you an idea re how to approach its solution. Enter the span and maximum tolerated waste at the top and in the matrix below, you'll see green numbers for exact matches and red ones for those that fall below the accepted waste. If it's not at all useful, kindly disregard.

 

 

@FarshidKaviani , As a variation to @Riny_van_Eekelen 's solution, you can use the Sover add-in to solve this problem. Here I'm setting the problem up to have a solution that the length is less than 20 with all 3 lengths to be used and be integers. You can adjust the constraints and play around with the type of solution you need. Hope this helps.

 

TheAntony_0-1594678628404.png

 

Elements34.25
Count221
Span19.4  

 

@Riny_van_Eekelen Thank you so much for your effort. I was looking for an automatic solution that does not involve so many manual data entries since the standard spans cover quite a wide range, but I found your solution very useful for optimizing the waste optimization which is equally important in my project.

 

I do appreciate your help!

Regards,

Farshid

@TheAntony Thank you so much for your help. I managed to solve the problem using your method but since the standard span of elements covers a wide range so I do appreciate any other suggestions that can take a range of numbers as standard element sizes.

 

I appreciate your time and help!

 

Regards,

Farshid

@FarshidKaviani , You can set the constraints as ranges instead of individual cells. See example. Hope that helps.

@TheAntony Thank you so much. That works perfectly!!!

@FarshidKaviani , Glad it helped!