10152009, 06:44 PM



Location: Denver
690 posts, read 1,899,596 times
Reputation: 353


I have a strange problem. I have this list of 11 numbers. I need to use some of these numbers to come to a total of exactly $3,144.78. I don't need to use all the numbers to come to that total (if I use all of them, the total is over $4,000) and I don't know which ones I'm supposed to exclude. I also don't know how many of the 11 numbers I need to use.
I was thinking about how hackers sometimes have software that can very quickly come up with thousands of different letter and number combinations to guess passwords. I'm not hacking, I promise. But that made me think that maybe there's a way to solve my problem in Excel or Access or maybe just by using some kind of weird math technique.
Can anyone help? Any advice or suggestions would be greatly appreciated.

10162009, 10:35 AM



28,651 posts, read 40,644,886 times
Reputation: 37347


Sounds like me when I'm doing yearend and balancing my books!
An easy out would be putting the numbers here. If no one else attacked it, I would. I love this type of problem.
I'd start with the largest number. If I remove it do the rest add up to more than the target? If not, then the largest number must be included. If the largest runs over then do the same for the second largest.
In a program like Excel you could place them in a column that is summed and remove one or more to see how the sum changes. Delete a number and if need be use undo to put it back.
Programming would require some interesting loops to accomplish, I think.
I would look for combination's that give .78 as a remainder and see if they then add up to the correct total. That eliminates worrying about the tens, hundreds, and thousands columns until you get the decimal correct.

10162009, 12:26 PM



2,893 posts, read 5,344,138 times
Reputation: 1978


All the numbers total 4,000. You need a total of 3,144.78. Subtract them, you only have to find the numbers that add up exactly to 855.22. That should be fewer numbers and easier to narrow down. Those numbers get discarded, and the remaining numbers will be the necessary ones.

10162009, 08:35 PM



28,651 posts, read 40,644,886 times
Reputation: 37347



10172009, 12:40 PM



Location: Denver
690 posts, read 1,899,596 times
Reputation: 353


Thanks for your suggestions. I asked my question at the Microsoft Discussion forum, too. And someone suggested I go to this link: http://tinyurl.com/5kx9bw
It's right along the lines of what you were thinking, Tek_Freek. It worked perfectly. I was pretty excited! It never ceases to amaze me how much time we waste at work because we're not aware of all these different features in Excel and Access.

Please register to post and access all features of our very popular forum. It is free and quick. Over $68,000 in prizes has already been given out to active posters on our forum. Additional giveaways are planned.
Detailed information about all U.S. cities, counties, and zip codes on our site: Citydata.com.

