#1   Report Post  
Mark1
 
Posts: n/a
Default Summing Program

Anybody ever run across a function, combination of functions or VBA code that
will go through a list of numbers and find a combination of those numbers
that equals a pre-designated total? For example, if I have the following
list of numbers:

5
2
3
7

I want to know the combinations of those numbers that is going to equal 10.
Anybody, ever run across or tried anything like this?


  #2   Report Post  
Dave O
 
Posts: n/a
Default

I've written code to do exactly that. One of the consequences of this
"brute force" method of checking every possible combination of numbers
is that as the pool of numbers increases by one the number of
combinations doubles. This is fine and grand when the pool is twenty
numbers, but the jump from 24 numbers in the pool (roughly 16.8 million
combinations) to 25 numbers (about 33.5 million combinations) causes
the processing time to increase.

What is your application? This software is not ready for prime time in
terms of saleabililty, but I'd be happy to run it for you on a one-ff
basis. Contact me at cyclezen AT yahoo DOT com.

  #3   Report Post  
Mark1
 
Posts: n/a
Default

Thanks Dave 0. I was going to attempt the code myself, but I wanted to see
if there was anybody that had tried it. I have a lot of numbers, close to
1,000 so I think that I would be wasting yours and my time. Also, I'm not
really sure that it would get me closer to the answer I'm looking for. I
appreciate your help though. Thanks again!

PS - I'm sure someone besides just you and me have needed this. I guess the
reason it never made it to the Excel built-in functions is because of the
calculation time.

"Dave O" wrote:

I've written code to do exactly that. One of the consequences of this
"brute force" method of checking every possible combination of numbers
is that as the pool of numbers increases by one the number of
combinations doubles. This is fine and grand when the pool is twenty
numbers, but the jump from 24 numbers in the pool (roughly 16.8 million
combinations) to 25 numbers (about 33.5 million combinations) causes
the processing time to increase.

What is your application? This software is not ready for prime time in
terms of saleabililty, but I'd be happy to run it for you on a one-ff
basis. Contact me at cyclezen AT yahoo DOT com.


  #4   Report Post  
Dave O
 
Posts: n/a
Default

When I plug 2 to the 1000th power into my calculator I get a scientific
notation response equivalent to
9,999,999,000,000,000,000,000,000,000,000,000,000, 000,000,000,000,000,000,000,000,000,000,000,000,00 0,000,000,000,000,000,000,000,000
possible combinations. We'd need a quantuum improvement in processor
ability to even consider this.

Is it possible to pare down the number pool? For instance, if there
are no negative numbers in the pool, then any number greater than the
target number can be removed from the pool. There may also be other
ways to reduce the pool: for instance, if your target number has to do
with a list of checks, say, written before June 1 and some of the pool
numbers are from July, they can be removed.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display a form- to show status of the running program Joseph Excel Discussion (Misc queries) 2 May 31st 05 11:31 AM
Hyperlink in Excel opens the right program, but can't read file. Katydid Excel Discussion (Misc queries) 0 May 6th 05 04:16 PM
What program would work better? tb Excel Discussion (Misc queries) 3 March 11th 05 06:31 AM
Cumulative Summing Carpie Excel Discussion (Misc queries) 3 February 11th 05 04:35 PM
Charts causing program to crash Fysh Charts and Charting in Excel 1 December 16th 04 10:12 PM


All times are GMT +1. The time now is 05:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"