View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jennifer_C via OfficeKB.com Jennifer_C via OfficeKB.com is offline
external usenet poster
 
Posts: 3
Default calculate various cells to acheive a specific value

Thank you for the input! It was easy to follow, however, it was taking too
long to complete, and I never got a correct answer. I think it might have
been better if I didn't have as much data to work with...
Thank you again!

Peo Sjoblom wrote:
You would need to use code or the solver add-in, for the solver add-in using
your example you would create something like this

546 1
9732 1
654 1
6548 1
687 1
9871 1

assume that is A1:B6 (you would put 1s in B1:B6)

in C1 put

=SUMPRODUCT(A1:A6,B1:B6)

in D1 put

10,525

do toolssolver

then set target cell $C$1 equal to value of 10525
by changing cells $B$1:$B$6

then click add and use $B$1:$B$6 and from dropdown select bin, click OK

then click solve

depending on how large (note that the solver that comes with Excel is
limited)
the range is it can take some time to get a solution, but your example gives
this result

546 0
9732 0
654 1
6548 0
687 0
9871 1

where the 1s in B1:B6 show which 2 amounts total 10,525

I believe Harlan Grove wrote VBA code to do this as well, you can Google on
that

Hello,
I am trying to identify two cells within a column that total a specific

[quoted text clipped - 18 lines]

Jennifer


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200707/1