# Thread: Alternative to solver, numbers (no more than 5) add up to goal, several hundred rows Thanks: 0 Likes: 0

1. ## Alternative to solver, numbers (no more than 5) add up to goal, several hundred rows

Hi team,
I have a bit strange problem. Quite often one payment needs to be split to several invoices.
Most days there are no issues, however some days this split data total does not add up to original number. If there is a difference I would like to use some formula to try to find combination of available numbers that add up to the diff. I could use solver, but it can only handle around 25 rows (using sumproduct col1 are numbers, col2 are either 1s or 0s). I tried simple for loop inside for loop inside for loop, if two or three numbers add up to an amount, but it is a bit clunky.

Can anyone think of an alternative, please?

Original data
100.1
200.2
300.3

Split
100.1
200.2
301.3
-1.00
50.4

Here, problem is easy. But this 50.4 can be combination of many numbers.

I only started looking into this issue recently, so I need to reconcile lots and lots of old data.
In the future i will add an index column, if data is split and sorted it will still have index number or someone can think of something better.

Nick

2. ## Re: Alternative to solver, numbers (no more than 5) add up to goal, several hundred rows

This website is ok, but only finds one match. Perhaps that is all I need as I will try to remove as much data as possible before working on data.
https://www.extendoffice.com/documen...given-sum.html

not the easiest formula to understand
Code:
`=IF(ISNUMBER(MATCH(ROWS(\$1:1),IF(INDEX(MOD(INT((List2-1)/2^(TRANSPOSE(List1)-1)),2),MATCH(TRUE,MMULT(MOD(INT((List2-1)/2^(TRANSPOSE(List1)-1)),2),Range1)=\$C\$2,0),),TRANSPOSE(List1)),0)),"X",""), and press Shift + Ctrl + Enter`