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

nikio8

Board Regular
Joined
Oct 20, 2017
Messages
128
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.


Thanks in advance
Nick
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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/docume...nd-all-combinations-that-equal-given-sum.html

not the easiest formula to understand
Code:
[COLOR=#0A0101][FONT=&quot][B]=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","")[/B][/FONT][/COLOR][COLOR=#0A0101][FONT=&quot], and press [/FONT][/COLOR][B]Shift + Ctrl + Enter[/B]
 
Upvote 0

Forum statistics

Threads
1,223,631
Messages
6,173,465
Members
452,516
Latest member
archcalx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top