Hi everyone, I need your help because I'm going crazy. I need to create a program that, starting from an imported dataset, searches for the first possible combination of amounts, which when added together give the searched amount. Let me explain better with an example. Suppose we have a dataset consisting of two columns. In the first column there is a list of amounts, which represent the invoices received, in the second column the amount to search for (which is repeated the same for the entire extension of the dataset). I need the program to find the combination of amounts in the first column that result in the amount found in the second column. Example: Column 1: 100 200 50 400 1000 Column 2: 1700 1700 1700 1700 1700 I need the program to find the combination that gives the result 1700. So it will be line 1 + line 2 + line 4 + line 5. If there are multiple combinations, he will have to stop at the first find, without continuing further. Finally, I would need this combination to be reported in a new column called "combination". I have made many attempts, but I can only use "nested cycles" which however allow limited management of the amounts. In my project, the invoices to be added to arrive at the amount to be searched for can even be hundreds. Thanks for your help
... View more