I am trying to pick the best scenario from data in two columns: Column 1 contains values for 20 rows (4, 6, 8, 10.5, 13, etc). Column 2 contains values for the same 20 rows (1100, 950, 800, 750, etc).

I need to look for the 6 lowest possible average value in column 1 while not exceeding a specific value in column 2. e.g. 5000. The goal is to have the lowest value for column 1 while getting as close to 5000 in column 2.

Example: Row1 4, 1100, Row3 8, 800, etc. This would be avg 6 total of 1900. (I just did 2 rows, but I need the best of 6.) I tried to post a screenshot, but I don't have enough reputation points. :(

Any help would be greatly greatly appreciated!

`A`

,`B`

, etc. There is no such thing as “Column 1”. (2) Actually, it's betternotto use screenshots. Just type in representations of your data, as was done here and here. (3) And it would be much better if you would post an example thatillustratesyour problem, rather than just fitting the description. For example, it seems "obvious" that the solution is to pick the smallest six numbers from Column A. … (Cont’d) – Scott Sep 19 '15 at 7:34example where the solution is not the six lowest numbers from Column A. (It goes without saying that such an example must haveclearat leastseven rows.) (4) Do you want the six lowest possible average value in column A while not exceeding a total of 5000 in column B, or do you want to get as close as possible to 5000? What does “getting as close to 5000 in column B” mean? (5) Just off the top of my head, I believe that 1100+800 is 1900. – Scott Sep 19 '15 at 7:34