Require change to limit exact sum output combinations

Kishan

Well-known Member
Joined
Mar 15, 2011
Messages
1,648
Office Version
  1. 2010
Platform
  1. Windows
Using Excel2000

Hi,

Till now I was using "pgc01 code" which is amazing, I found code under this link
https://www.mrexcel.com/forum/excel-questions/277924-combination-help-5.html#post1424848

I require modifications code only output Permutation Repetition with a desire sums

For example...
In the cells B6:B10 there are numbers 0,1,2,3,4,5 I need all Permutation Repetition could be find with SUM = 43. Is it possible?
Layout is not important could be the any way depending on the new or modified code

Data example....


Book1
ABCDEFGHIJKLMNOPQRS
1P14*3333334242444143
2CombinationsFALSE*2243232334533443
3RepetitionTRUE*5214323234432543
4***5353254411134243
5Set Col B5 Down0*4245432333134243
6*1*2422354343431343
7*2*3142343355144143
8*3*3222541534323443
9*4*2353454144112443
10*5*5314344442311443
11**3351224431533443
12**5045353213512443
13**2335142322543443
14**2334452232233543
15**1313514345334343
164242442333334243
171413455233432343
18
19
Sheet1


Thank you in advance


Regards,
Kishan
 
Last edited:
My formula

=PERMUT(14,14)/PRODUCT(PERMUT({3,1,3,6,1}, {3,1,3,6,1}))

or

=FACT(14)/PRODUCT(FACT({3,1,3,6,1}))
 
Last edited:
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
=product(combin(14-{0,3,4,7,13}, {3,1,3,6,1}))
Hi shg, too many combinations did not imagine</SPAN></SPAN>

Thank you for your help and time</SPAN></SPAN>

Kind Regards,</SPAN></SPAN>
Kishan </SPAN></SPAN>
 
Upvote 0
My formula

=PERMUT(14,14)/PRODUCT(PERMUT({3,1,3,6,1}, {3,1,3,6,1}))

or

=FACT(14)/PRODUCT(FACT({3,1,3,6,1}))
Hi B___P, "FACT" formulas is neat, I am surprised to see that row 17 post#7 could be written in the 3.363.360 ways. But it is true as formula result amazing.</SPAN></SPAN>

Thank you for your help and time </SPAN></SPAN>

Kind Regards,</SPAN></SPAN>
Kishan</SPAN></SPAN> :)
 
Upvote 0
=FACT(14)/PRODUCT(FACT({3,1,3,6,1}))
That's equivalent mathematically but not computationally:

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][td="bgcolor:#C0C0C0"]
D​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
1​
[/td][td][/td][td="bgcolor:#F3F3F3"]
Repeats
[/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
2​
[/td][td][/td][td]
9​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td]C2: =SUM(B$2:B2) - B2[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
3​
[/td][td][/td][td]
12​
[/td][td="bgcolor:#E5E5E5"]
9​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
4​
[/td][td][/td][td]
18​
[/td][td="bgcolor:#E5E5E5"]
21​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
5​
[/td][td][/td][td]
12​
[/td][td="bgcolor:#E5E5E5"]
39​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
6​
[/td][td][/td][td]
11​
[/td][td="bgcolor:#E5E5E5"]
51​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
7​
[/td][td][/td][td]
14​
[/td][td="bgcolor:#E5E5E5"]
62​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
8​
[/td][td][/td][td]
9​
[/td][td="bgcolor:#E5E5E5"]
76​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
9​
[/td][td][/td][td]
11​
[/td][td="bgcolor:#E5E5E5"]
85​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
10​
[/td][td][/td][td]
8​
[/td][td="bgcolor:#E5E5E5"]
96​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
11​
[/td][td][/td][td]
12​
[/td][td="bgcolor:#E5E5E5"]
104​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
12​
[/td][td][/td][td]
12​
[/td][td="bgcolor:#E5E5E5"]
116​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
13​
[/td][td][/td][td]
11​
[/td][td="bgcolor:#E5E5E5"]
128​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
14​
[/td][td][/td][td]
12​
[/td][td="bgcolor:#E5E5E5"]
139​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
15​
[/td][td][/td][td]
8​
[/td][td="bgcolor:#E5E5E5"]
151​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
16​
[/td][td][/td][td]
12​
[/td][td="bgcolor:#E5E5E5"]
159​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
17​
[/td][td="bgcolor:#F3F3F3"]
Total
[/td][td="bgcolor:#E5E5E5"]
171​
[/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
18​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
19​
[/td][td][/td][td][/td][td="bgcolor:#E5E5E5"]
1.352E+187​
[/td][td]C19: {=PRODUCT(COMBIN(B17 - C2:C16, B2:B16))}[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
20​
[/td][td][/td][td][/td][td="bgcolor:#E5E5E5"]
#NUM!​
[/td][td]C20: {=FACT(B17)/PRODUCT(FACT(B2:B16))}[/td][/tr]
[/table]
 
Upvote 0
That's equivalent mathematically but not computationally:

[TABLE="class: grid"]
<TBODY>[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
A​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
B​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
C​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
D​
[/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
1​
[/TD]
[TD][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=f3f3f3]#f3f3f3[/URL] "]
Repeats
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
2​
[/TD]
[TD][/TD]
[TD]
9​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
0​
[/TD]
[TD]C2: =SUM(B$2:B2) - B2
[/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
3​
[/TD]
[TD][/TD]
[TD]
12​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
9​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
4​
[/TD]
[TD][/TD]
[TD]
18​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
21​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
5​
[/TD]
[TD][/TD]
[TD]
12​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
39​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
6​
[/TD]
[TD][/TD]
[TD]
11​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
51​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
7​
[/TD]
[TD][/TD]
[TD]
14​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
62​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
8​
[/TD]
[TD][/TD]
[TD]
9​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
76​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
9​
[/TD]
[TD][/TD]
[TD]
11​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
85​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
10​
[/TD]
[TD][/TD]
[TD]
8​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
96​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
11​
[/TD]
[TD][/TD]
[TD]
12​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
104​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
12​
[/TD]
[TD][/TD]
[TD]
12​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
116​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
13​
[/TD]
[TD][/TD]
[TD]
11​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
128​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
14​
[/TD]
[TD][/TD]
[TD]
12​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
139​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
15​
[/TD]
[TD][/TD]
[TD]
8​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
151​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
16​
[/TD]
[TD][/TD]
[TD]
12​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
159​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
17​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=f3f3f3]#f3f3f3[/URL] "]
Total
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
171​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
18​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
19​
[/TD]
[TD][/TD]
[TD][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
1.352E+187​
[/TD]
[TD]C19: {=PRODUCT(COMBIN(B17 - C2:C16, B2:B16))}
[/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=c0c0c0]#c0c0c0[/URL] "]
20​
[/TD]
[TD][/TD]
[TD][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=e5e5e5]#e5e5e5[/URL] "]
#NUM!​
[/TD]
[TD]C20: {=FACT(B17)/PRODUCT(FACT(B2:B16))}
[/TD]
[/TR]
</TBODY>[/TABLE]
Hi shg, thank you for explanation that formula fails in some situationes, why I said "FACT" formulas is neat because I tried your formula post#10 to understand but did not workout the first values where form are generated please can you explain values shown in red =product(combin(14-{0,3,4,7,13</SPAN></SPAN>}, {3,1,3,6,1}))</SPAN></SPAN>

Thank you
</SPAN></SPAN>

Kind Regards,
</SPAN></SPAN>
Kishan
</SPAN></SPAN>
 
Upvote 0
Choose 3 of 14 for the first number.

There's 11 left: Choose 1

There 10 left: Choose 3

There's 7 left: Choose 6

There's 1 left: Choose 1

Multiply all those together.

There's no need to quote my posts back to me.
 
Upvote 0
@shg, got it, thank you for explaining in details </SPAN></SPAN>

Kind Regards,
</SPAN></SPAN>
Kishan
</SPAN></SPAN>
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
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