+ Reply to Thread
Results 1 to 9 of 9

procedure :Recursion

  1. #1
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    procedure :Recursion

    Hi,

    Is there a "ready made" Recursion procedure that can be adopted in order to present the numbers that sum up to a given number ?

    for example:
    In cells A1:A10 there are 10 numbers (could be any numbers).
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10

    The sum request is: 8
    The procedure should present, in column "C" the unique numbers that sum up to Exactly 8

    In this example, the results to be presented, in B1:B5, are:
    1,7
    2,6
    3,5
    1,2,5
    1,3,4

    Thanks, Elmer

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    re: procedure :Recursion

    I think you will need to look at Excel's Solver feature
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    re: procedure :Recursion

    Thank you.

    I could not figure out how to use the "Solver" to solve my request.

    Would you be so kind to present an Example and/or some Link(s) to where from such a calculation can be adopted.

    Elm

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    re: procedure :Recursion


  5. #5
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    re: procedure :Recursion

    Believe me that I know how to Google...

    However I did not find anything that comes even close to what I was asking.

    Elm

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    re: procedure :Recursion

    Please Login or Register  to view this content.
    For your example,

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    re: procedure :Recursion

    Super Professional.

    But... if I'm not mistaken the code results are presented as the Cells Number and not their content.

    Upon trying to match a sum of 55 - for the A1:A5 (here below), the code presents 1,2 instead of 22, 33.

    22
    33
    45
    35
    66

    What can be changed in order to present the values that match the requested sum

    Thanks, Elm
    Last edited by ElmerS; 09-24-2009 at 12:43 PM.

  8. #8
    Forum Contributor
    Join Date
    09-23-2008
    Location
    Mexico
    Posts
    200

    re: procedure :Recursion


  9. #9
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    re: procedure :Recursion

    Thank you Armando,

    However, if you'll try:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10

    for a sum of 8 - you'll find out it ends up with only one single value: 8 while I want to see all combinations that match the sum of 8.

    If you'll look closer you'll see that there are at least 5 different pairs that match the requested sum.

    Elm

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1