Hi,
although the solver works a treat if you just need one random combination that adds up, it might result in something very unlikely and possible combination can be so numerous that you can't get all.
(we've customers with over 1200 open invoices of which various with identical value)
I've tried once to create an algorhitm for this very issue.
I did manage to get something that would give me a series of likely results if there were any.
Points that can help to optimize are:
Credit notes are likely to be included. So one option is to add all the negatives to the paid amount.
Invoices that are disputed will not be included in the payment, so those can be taken out.
Customers are likely to pay the invoices according to due date.
So start with the oldest and then start adding the values of the consecutive invoices.
I don't have the actual code anymore, but if I remember correctly, I started at invoice 1, then incremented the range until it started exceeding the paid amount, read in all of the credit notes and tested if I could get to the amount by reducing the amount with those, until I got below again and then started incrementing again, etc. etc. I also built in 3 wildcards values that could be either taken out of the current range or added from outside of that range. Once I'd run out of options for the current series, I started decreasing the range from the bottom until I got below the amount again at which point the range started incrementing from the top again and so on.
Unfortunately, the number of permutations made it a rather lenghty process, i.e. 100 Invoices would take over 2.5 hours, but I did get a 75% hitrate and I wasn't that proficient in VBA at the time, so I'm sure that the code could have been tuned quite a bit.
Hope this helps you somewhat.
Cheers,
Roel