[AccessD] Math Problem

Lonnie Johnson prodevmg at yahoo.com
Tue Oct 14 13:00:10 CDT 2003


Thank you Gustav,
 
The number of rows may vary with each client. This will be an accounting feature. There will be a client number and that's how I will group. A client could have one record or ten records. I was looking for something efficient and something that I could load a couple of variables which would be the number of records and an array of the values.
 
Thanks again.

Gustav Brock <gustav at cactus.dk> wrote: 
Hi Lonnie

If you only have a few rows as shown I don't think you have any other
possibility than trying the different combinations using some loops.

You could, of course, start by ruling out some of the impossible
combinations by adding all the negatives and all the positives; here
it will return -5 and +18 which shows that 7 can be ruled out as it is
larger than the absolute value of the sum of negatives. On the other
hand, -2 and -3 must be included in any combination as the absolute
value of the sum of these equals the smallest positive number, 5.

If you have many rows you'll have to find some smarter routines as the
number of combinations increase dramatically.

/gustav


> This is one for the math guys who code. I have a situation where I need to take a field in a group of records and see if any combination of the values in the field equal zero.

> Example:

> MyField
> 5
> -2
> 7
> -3
> 6

> This group of records would have a combination that equals zero (5, -2, -3). I hope someone has something. 

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


Lonnie Johnson
ProDev, Professional Development of MS Access Databases
Visit me at ==> http://www.prodev.us




 




---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20031014/1a41a753/attachment-0001.html>


More information about the AccessD mailing list