To find a combination, which total is equal to a target number using php. Recursion is the Best way to find it. I have tried to derive macro coding worked in this excel sheet, you can download it in here Dicks. This excel will provide the exact combinations of the target value and the Nearest combination to the target value.I don’t know the exact data flow algorithm in this macro. But I have made the Alternate solution here using php.
I achieved this by working with 3 recursion functions. Please mail me at email@example.com , if you find any issues on my code. It would take some time to load, But not too long.
Example Below is Done By Pulling records From Database. This Result will provide you one Exact or one exact Nearest values
for Getting More Matches you need to comment these function filterInvoice() and searchSumOfMaxMacro()