Best fitting a range of data to a particular value



Hi,

I am struggling to find the answer to the following:

I have three columns of data, consisting of up to ten values.

I need to search through this data and find the best combination to
fulfill a value. Ie I have a value X which is made up of ONE value from
range A, possibly ZERO to THREE values from range B and possibly ZERO
to TWO from range C.


Eg.


Range A: 150,300,450,600,900,1200,1500,1800,2100,2400
Range B: 150,300,450,600,900,1200,1500,1800,2100,2400
Range C: 50,75,100,150,200,250

I require a result in the form of a table that I can tabulate the
quantities for each size in each range. Choosing the largest possible
value from each range until it is unable to fit any more from that
range.

if X=3200 then the result would be:

1x2400 (from range A)
1x600, 1x150 (from Range B)
1x50 (Range C)

any 'left over' would be less than 50.

if X=555

the result would be:

1x450 (from range A)
1x50 (from range C)

Cheers guys in advance. I've tried various ways using IF statements,
not sure if LOOKUP will work and also tried VBA using FOR loops to no
luck.

Regards,

Rob

.



Relevant Pages

  • Re: Rookie having problems with some filter code. Any help?
    ... Don Bruder writes: ... you bring up a valid point - one which I've been struggling ... >with - How to cope with color values that go negative while being ... to 255 - not wrapped around to zero. ...
    (sci.image.processing)
  • Re: the binary tree
    ... Please demonstrate the first several layers of this binary tree. ... consider the left branch to be a zero ... I place the binary point, is the first row, consisting ...
    (sci.math)
  • Re: the binary tree
    ... number of reals between zero and one in a countable ... It's just the standard binary tree: ... consider the left branch to be a zero ... I place the binary point, is the first row, consisting ...
    (sci.math)
  • Linking different Chapters to a TOC
    ... I am struggling to link the following: ... consisting of different chapters - each saved as ... seperate word documents. ... How can I easily link them together once finished, ...
    (microsoft.public.word.docmanagement)
  • Re: including . in a pattern match
    ... > I have tried a couple of things but I am struggling with how to optionally ... > zero or one decimal point followed by ... What you want is $REout of that package. ... Prev by Date: ...
    (perl.beginners)