PDA

View Full Version : find unknown values which adds up to some values



aravindhan_3
07-10-2009, 05:04 AM
Hi,

I have some 100 values in Column A:like
1323
2876.02
3910.33
3360.43
2786.28
5458.01
5476.15
92.19
etc..
And in Cell B2 I have a value 49904.66 ( this is summation of some values from column A, but i dont know what are the values contributed to this)

Is there a way in VBA to check what are the values contributing to the value in B2 and highlight the cells in Column A?

please find the Cross post is here: http://www.excelforum.com/excel-programming/690959-find-unknown-values-which-adds-up-to-some-values.html#post2125207

Thanks n Regards
Arvind

JimmyTheHand
07-10-2009, 05:46 AM
Well, if it's not solver then maybe this:

Sub test()
Range("B2").DirectPrecedents.Interior.ColorIndex = 17
End Sub

Jimmy

macropod
07-11-2009, 04:09 AM
Hi Arvind,

See my post at: http://www.tek-tips.com/viewthread.cfm?qid=1485698

The code there is for up to 3 values that sum to the desired target. Do note that expanding the # values will dramtacially increase the execution time.

aravindhan_3
07-15-2009, 09:33 PM
Hi,

Thanks for your help:

The excel solver works for me if I have some 20 - 25 lines and it throws me an error " too many adjustable cells: for 300 line.

I tried with this code. here :
http://www.tek-tips.com/viewthread.cfm?qid=1485698

I entered A2:A300 for input & B2 for target value but I am not getting any result.
I also tried the template from
http://www.tushar-mehta.com/excel/te...olver_Template (http://www.tushar-mehta.com/excel/templates/match_values/index.html#Solver_Template) however it doest not support for 300 lines
the other threads i tired are :
http://www.mrexcel.com/forum/showthread.php?t=22298
http://www.mrexcel.com/pc09.shtml

I am not able to solve the problem. I have attached my file for reference.

help me guys

aravindhan_3
07-15-2009, 09:35 PM
file attached.