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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
=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:

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


A​

B​

C​

D​

1​

Repeats

2​

9​

0​
C2: =SUM(B$2:B2) - B2

3​

12​

9​

4​

18​

21​

5​

12​

39​

6​

11​

51​

7​

14​

62​

8​

9​

76​

9​

11​

85​

10​

8​

96​

11​

12​

104​

12​

12​

116​

13​

11​

128​

14​

12​

139​

15​

8​

151​

16​

12​

159​

17​

Total

171​

18​

19​

1.352E+187​
C19: {=PRODUCT(COMBIN(B17 - C2:C16, B2:B16))}

20​

#NUM!​
C20: {=FACT(B17)/PRODUCT(FACT(B2:B16))}

<TBODY>
</TBODY>
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,214,591
Messages
6,120,424
Members
448,961
Latest member
nzskater

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