+ Reply to Thread
Results 1 to 10 of 10

Pick rectangle from list that is larger than other rectangle and minimize area.

  1. #1
    Registered User
    Join Date
    02-05-2020
    Location
    Jefferson City, MO
    MS-Off Ver
    1902
    Posts
    5

    Pick rectangle from list that is larger than other rectangle and minimize area.

    Hello. I have four columns: two that give length (L) and width (W) of parts to be manufactured and two that list the length and widths of our available stock (Blank_L, Blank_W). I have created a columns that pull the unique lengths and widths from the Blank_L and Blank_W columns so that I can us INDEX() and MATCH() to round L and W up to the next largest blank sizes. However, just because I know the next size up doesn't mean that a blank with that combination of Blank_L and Blank_W actually exists. Looking for help coming up with a method to choose the next biggest blank size that minimizes area.

    Thanks,

    Joshua Wentworth

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,800

    Re: Pick rectangle from list that is larger than other rectangle and minimize area.

    It would help if you attached a sample Excel workbook, so we can see which columns contain your data.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.

    Don't try to use the Paperclip icon, as it doesn't work on this forum.

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    Re: Pick rectangle from list that is larger than other rectangle and minimize area.

    Hi you can make use of Large(array,2) function to find the second largest value from the array.
    *If you wish you click on *,a way to say ThankYou

  4. #4
    Registered User
    Join Date
    02-05-2020
    Location
    Jefferson City, MO
    MS-Off Ver
    1902
    Posts
    5

    Re: Pick rectangle from list that is larger than other rectangle and minimize area.

    Unfortunately this is for my employer and I don't think they would appreciate me sharing their data. I can maybe make a small sample workbook if that is needed.

  5. #5
    Registered User
    Join Date
    02-05-2020
    Location
    Jefferson City, MO
    MS-Off Ver
    1902
    Posts
    5

    Re: Pick rectangle from list that is larger than other rectangle and minimize area.

    Quote Originally Posted by Sunny18pc View Post
    Hi you can make use of Large(array,2) function to find the second largest value from the array.
    I'm not sure I understand how this helps me.

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,856

    Re: Pick rectangle from list that is larger than other rectangle and minimize area.

    This has echos of the 2D cutting stock problem, so my first question is whether or not this is a cutting stock problem or if it will expand into a cutting stock problem, or if it really will be simpler than cutting stock. Because the full cutting stock problem is NP-hard, it can be a challenge to program the algorithm into Excel (or any programming language).

    This very old forum post over at MrExcel suggests a couple of preprogrammed, non-Excel solutions. https://www.mrexcel.com/board/thread...6/#post-327860 The links may be dead, but, as common as the cutting stock problem is, even today it might be easier to find someone else's implementation rather than program your own.

    If it really is as simple as choosing which blank to cut one, single piece from, I would probably set up a series of columns with the dimensions for all of my blanks, put the dimensions of my one piece at the top of adjacent column(s), then build a formula that will test each piece and calculate the area wasted for each blank. Then simply scan the results for the smallest wasted area.

    At this point I don't offer any specifics, because I want to make sure we understand the full extent of your request.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    Re: Pick rectangle from list that is larger than other rectangle and minimize area.

    Why don't you go for excel solver, THAT COULD ALSO HELP YOU HERE

  8. #8
    Registered User
    Join Date
    02-05-2020
    Location
    Jefferson City, MO
    MS-Off Ver
    1902
    Posts
    5

    Re: Pick rectangle from list that is larger than other rectangle and minimize area.

    My background is in Mechanical Engineering not programming so I can't say I am familiar with the cutting stock problem but I will do some more research into that. I believe what you're asking is if I will need multiple parts to be nested into a single piece of material which I am trying to avoid having to think about :P . You are right that I could create an entire column that calculate the waste for each blank size but when you're working with a couple thousand different parts that solution breaks down pretty quickly (at least in my head).

  9. #9
    Registered User
    Join Date
    02-05-2020
    Location
    Jefferson City, MO
    MS-Off Ver
    1902
    Posts
    5

    Re: Pick rectangle from list that is larger than other rectangle and minimize area.

    The end goal was to use the solver to vary the available blank sizes to minimize the manufacturing waste/cost so I can't really use it as an intermediate step in the calculations.

  10. #10
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,856

    Re: Pick rectangle from list that is larger than other rectangle and minimize area.

    I believe what you're asking is if I will need multiple parts to be nested into a single piece of material which I am trying to avoid having to think about :P
    You and I might want to avoid thinking about it, but someone, somewhere, someday will ask about it ("Hey, can't we further reduce waste by cutting one or more of the smaller pieces from the current waste sections?") and then, thinking that this will be just like asking about a single piece from a piece of stock, will ask you how to further reduce waste. As a programmer, I think I would want a fairly clear sense of the scope. If I solve the "one piece from one blank" problem, and next week they are going to ask me to expand that, then I would rather start with the full scope in front of me.

    You are right that I could create an entire column that calculate the waste for each blank size but when you're working with a couple thousand different parts that solution breaks down pretty quickly (at least in my head).
    Yes, part of the challenge with these kinds of problems (especially problems like the NP-hard cutting stock problem) is how quickly they expand. It starts with the seemingly simple "how much waste is generated when I cut one piece from one blank" to how much waste is generated when I cut multiple pieces from multiple blanks". In some ways, the larger problem might just be a recursive implementation of the smaller problem. Maybe once you can solve the "how much waste is generated by cutting one piece from one blank" problem, then you can apply it recursively to different blanks and/or parts (in a spreadsheet this usually means making multiple copies of the row/column/block of cells that performs the calculation), then study the results of the recursion.

    As Sunny18pc notes, many people try to approach these kinds of problems using Excel's Solver. Basically you solve the "how much waste" problem, then have Solver minimize that waste. Here's one example (I think this is 1D cutting stock): http://blog.excelmasterseries.com/20...aste-with.html
    Here is Solver's developers' 1D cutting stock example: https://www.solver.com/cutting-stock

    Still not much specific, but again, I am trying to see just how big this is going to get before making specific recommendations.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] CCW Rotated Coordinates of a Rectangle?
    By Kenneth Hobson in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-26-2016, 06:17 PM
  2. VB Code to draw rectangle per data size
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2016, 11:52 AM
  3. How to use a Rectangle shape as progress bar
    By Awni in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2016, 05:07 PM
  4. Add rectangle shapes at the beginning and end of a bar
    By savy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2015, 04:06 PM
  5. Rectangle graph
    By Jan Rennel in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 02-06-2014, 06:49 AM
  6. Puzzling grey rectangle
    By norgro in forum Excel General
    Replies: 10
    Last Post: 12-22-2012, 02:51 AM
  7. Rectangle with curved corners
    By Zone in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2006, 02:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1