View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Anthony D Anthony D is offline
external usenet poster
 
Posts: 78
Default Distribute Lengths without loss

Hi John,

This may well be a 'hard' problem requiring specialised algorithms to get
the optimal solution in all cases.
If two pieces are 16' and 10', this leaves 97' in total for 23 pieces ?

Without knowing the lengths required, would perhaps one approach be to sort
both the available pipe lengths and the 25 required pipe lengths into
increasing length order and then match up the smallest required with the
smallest available ?

Anthony


"John Cole, Jr." wrote:

I have the need to take several lengths of pipe and break them up into
several smaller pieces. The problem is I need to be able to match them
up eliminating as much loss as possible. For example, I have 5 pieces
of pipe. They are 40', 27', 32', 15' and 9' long. I have to cut these
into 25 pieces of various smaller lengths. I need to be to do that
without leaving too many unusable pieces left over. If two of teh ones
I need are 16' and 10' then I would want to assign them to the 27' long
piece because it only cause me to lose 1'. Can anyone help me with
this?

I am pretty good with VBA, and I'm a very experienced Excel user. I
just don't even know where to begin with something like this.

Thanks for the help in advance!!!