Generate combination using base line data.

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
Using Excel 2010

Hello,

I have 14 number base line which sums are 122 I want to VBA or formula that can generate different all possible combinations which sum as per base line =122.

My 14 numbers base line is in range D7:Q7 which sums are in cell R7=122 and some example combinations are generated manually in range D9:Q13 each line sum match with base line = 122.

Please I need all combinations could be made from base line having rules: in each column of base line add 1 (+1) , or minus (-1), or keep same number to build combination with sum 122

Keep Same Sum.xlsm
CDEFGHIJKLMNOPQRSTUVWXY
5
6n1n2n3n4n5n6n7n8n9n10n11n12n13n14Sum
791011129765910108106122<-------------Example1 My base set of 14 numbers are in D7:Q7….That sum 122
8
989111298669999107122I want a VBA which can make all unique possible combinations from the base line Rules: adding 1 (+1) or subtracting 1 (-1) or keeping the same number in corresponding number of the each columns but total must be the same as the base line in this case 122. Few examples I build manually
109911128765101010997122
11810111298669109897122<-------------
12910111298561099996122
13991112985691099106122
14
Sheet1
Cell Formulas
RangeFormula
R7,R9:R13R7=SUM(D7:Q7)

I have asked question under the following link if require can be downloaded example worksheet.
Generate possible combinations but keeping the same sum.

Regards,
Moti
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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