Consulting

Results 1 to 5 of 5

Thread: find unknown values which adds up to some values

  1. #1

    find unknown values which adds up to some values

    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-prog...ml#post2125207

    Thanks n Regards
    Arvind

  2. #2
    Well, if it's not solver then maybe this:
    [vba]
    Sub test()
    Range("B2").DirectPrecedents.Interior.ColorIndex = 17
    End Sub
    [/vba]
    Jimmy
    -------------------------------------------------
    The more details you give, the easier it is to understand your question. Don't save the effort, tell us twice rather than not at all. The amount of info you give strongly influences the quality of answer, and also how fast you get it.

  3. #3
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    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.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    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 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

  5. #5
    file attached.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •