![]() |
Finding the elements of the sum
Hello!
Can you please help me in solving following problem: Given is the amount (for example 56,67) and massive: (for example 45,6; -3,2; 11,07; 58) Exercise is to show the components of the sum, which perform given amount. In our example the answer is 1. - 45,6 3. - 11,07 Can You give me an algorithm (and VBA code) to solve this problem in general - Given is N numbers (negative and positive) and searched amount (negative or positive)? If You have questions about problem, please ask from me: Regards, Jüri. |
Finding the elements of the sum
Solver could do this. Put the possible components in, say,
column A, enter 0's in column B, column C = A*B. In next row of C, sum rows above it. This would be cell C5 in your example. Run solver making column B the adjustable cells, constrained to integers, = 0 and <=1. Target C5 equal to the desired sum. HTH, Merjet |
All times are GMT +1. The time now is 04:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com