Next Smallest Value Excluding Results Already Used

%3CLINGO-SUB%20id%3D%22lingo-sub-1863448%22%20slang%3D%22en-US%22%3ENext%20Smallest%20Value%20Excluding%20Results%20Already%20Used%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1863448%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWondering%20if%20someone%20could%20help%20me%2C%20I'm%20an%20estimator%20working%20for%20a%20fencing%20company%2C%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20table%20that%20you%20enter%20all%20the%20different%20lengths%20of%20fence%20and%20it%20works%20out%20the%20number%20of%20panels%20required.%3C%2FP%3E%3CP%3EOn%20most%20lengths%20you%20have%20to%20cut%20the%20last%20panel%20down%20in%20order%20for%20it%20to%20fit.%3C%2FP%3E%3CP%3EThe%20offcut%20for%20this%20panel%20can%20then%20be%20used%20if%20a%20smaller%20last%20gap%20arises%20on%20another%20length.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20you%20need%20to%20look%20through%20all%20the%20lengths%20and%20find%20a%20gap%20that%20is%20smaller%20than%20the%20offcut%20on%20each%20individual%20length%3C%2FP%3E%3CP%3EThis%20is%20quite%20simple%20when%20using%20the%20small%20function%2C%20however%20obviously%20the%20same%20offcut%20cannot%20be%20used%20twice%2C%20so%20I%20need%20someway%20to%20exclude%20offcuts%20that%20have%20already%20been%20used.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESee%20below%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%22Clark_D_0-1604716730601.png%22%20style%3D%22width%3A%20663px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F232117iC02B49EC6376203C%2Fimage-dimensions%2F663x325%3Fv%3D1.0%22%20width%3D%22663%22%20height%3D%22325%22%20role%3D%22button%22%20title%3D%22Clark_D_0-1604716730601.png%22%20alt%3D%22Clark_D_0-1604716730601.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1863448%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-1863715%22%20slang%3D%22en-US%22%3ERe%3A%20Next%20Smallest%20Value%20Excluding%20Results%20Already%20Used%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1863715%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F860749%22%20target%3D%22_blank%22%3E%40Clark_D%3C%2FA%3E%26nbsp%3BFrom%20your%20picture%20it%20seems%20that%20you%20find%20a%20matching%20gap%20for%20an%20offcut%20by%20looking%20for%20the%20next%20smallest%20gap%20number%20in%20the%20list.%20Unless%20I%20misunderstood%2C%20there%20is%20a%20flaw%20in%20this%20approach.%20E.g.%20you%20match%20gap%203%20to%20offcut%203.%20This%20makes%20no%20sense%20as%20offcut%203%20is%20the%20result%20of%20closing%20gap%203.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20challenge%20is%20greater%20than%20just%20finding%20a%20matching%20gap%20for%20a%20particular%20offcut.%20I%20replicated%20your%20model%20based%20on%20the%20picture%20you%20provided%20(see%20attached).%20I%20used%20dynamic%20arrays%20to%20speed%20things%20up%2C%20but%20they%20may%20not%20work%20for%20you%20if%20you%20are%20on%20an%20older%20Excel%20version.%20Hopefully%20the%20picture%20will%20clarify%20my%20approach.%20If%20not%2C%20let%20me%20know.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20would%20want%20to%20minimise%20waste%20by%20using%20offcuts%20as%20effectively%20as%20possible%20and%20perhaps%20use%20one%20offcut%20to%20close%20multiple%20gaps.%20For%20instance%2C%20offcut%20number%208%20could%20be%20used%20to%20close%20gaps%201%2C%204%2C%205%20and%206%20leaving%20zero%20waste.%20Then%2C%20use%20offcut%207%20to%20close%20gap%203%20with%20some%20left-over%20and%20scrap%20offcut%202.%20Total%20waste%20would%20then%20be%200.4438%20of%20one%20standard%20length%20or%201.3%20meters.%20I've%20done%20this%20manually%20in%20columns%20I%3AJ%20with%20some%20SUMIF%20formulae%20at%20the%20bottom.%20Conditional%20formatting%20was%20used%20to%20visualise%20that%20there%20are%20is%20no%20offcut%20once%20a%20gap%20is%20closed%20and%20to%20avoid%20that%20gaps%20are%20matched%20to%20be%20closed%20by%20its%20own%20offcut.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOf%20course%2C%20there%20are%20other%20combinations%20possible%20and%20perhaps%20one%20of%20them%20results%20in%20less%20overall%20waste.%20In%20your%20picture%2C%20you%20only%20look%20at%208%20fences%2C%20and%20it's%20not%20too%20much%20trouble%20to%20do%20this%20manually.%20But%20I'm%20aware%20that%20this%20process%20may%20not%20be%20practical%20if%20your%20real%20life%20situation%20needs%20to%20deal%20with%20dozens%20of%20fences%20for%20which%20you%20want%20to%20optimise%20overall%20material%20usage.%20Perhaps%20the%20Solver%20add-in%20can%20be%20used%20to%20automate%20this%2C%20but%20goes%20beyond%20my%20area%20of%20expertise.%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%22Screenshot%202020-11-07%20at%2008.04.59.png%22%20style%3D%22width%3A%20734px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F232135iA96D944A60531DB8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202020-11-07%20at%2008.04.59.png%22%20alt%3D%22Screenshot%202020-11-07%20at%2008.04.59.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

Hi,

 

Wondering if someone could help me, I'm an estimator working for a fencing company, 

I have a table that you enter all the different lengths of fence and it works out the number of panels required.

On most lengths you have to cut the last panel down in order for it to fit.

The offcut for this panel can then be used if a smaller last gap arises on another length.

 

So you need to look through all the lengths and find a gap that is smaller than the offcut on each individual length

This is quite simple when using the small function, however obviously the same offcut cannot be used twice, so I need someway to exclude offcuts that have already been used.

 

See below

 

Clark_D_0-1604716730601.png

 

1 Reply
Highlighted

@Clark_D From your picture it seems that you find a matching gap for an offcut by looking for the next smallest gap number in the list. Unless I misunderstood, there is a flaw in this approach. E.g. you match gap 3 to offcut 3. This makes no sense as offcut 3 is the result of closing gap 3.

 

Your challenge is greater than just finding a matching gap for a particular offcut. I replicated your model based on the picture you provided (see attached). I used dynamic arrays to speed things up, but they may not work for you if you are on an older Excel version. Hopefully the picture will clarify my approach. If not, let me know.

 

You would want to minimise waste by using offcuts as effectively as possible and perhaps use one offcut to close multiple gaps. For instance, offcut number 8 could be used to close gaps 1, 4, 5 and 6 leaving zero waste. Then, use offcut 7 to close gap 3 with some left-over and scrap offcut 2. Total waste would then be 0.4438 of one standard length or 1.3 meters. I've done this manually in columns I:J with some SUMIF formulae at the bottom. Conditional formatting was used to visualise that there are is no offcut once a gap is closed and to avoid that gaps are matched to be closed by its own offcut.

 

Of course, there are other combinations possible and perhaps one of them results in less overall waste. In your picture, you only look at 8 fences, and it's not too much trouble to do this manually. But I'm aware that this process may not be practical if your real life situation needs to deal with dozens of fences for which you want to optimise overall material usage. Perhaps the Solver add-in can be used to automate this, but goes beyond my area of expertise.

 

Screenshot 2020-11-07 at 08.04.59.png