There is a listing of $ amounts (maybe 300-400 items). The amounts in the list may or may not be unique. Given an arbitrary number (N), I want to find the item(s) in the listing that come the closest to being a match within a tolerance (T) without being less than N.
Optimally, I would like to find one match that does not exceed T. However, that will not always be possible A basic example: Tolerance (T) = 1000.00 Items A- F represent a small subset of the $ listings A - 20,295.13 B - 35,985.55 C - 10,195.69 D - 28,655.78 E - 40,144.66 F - 32,490.50 1. Amount = 35,102.55 Best Match = B (35,985.55) Because even though it is greater than 35,102.55 it does not exceed the tolerance 2. Amount = 42,674.12 Best Match = C and F (10,195.69 + 32,490.50) The two combined are greater than the requested sum, but do not exceed the tolerance. It's easy to "eyeball" the best match within a tolerance, but I need a systematic way to determine "best combination". Any ideas?
