cant figure this out..

AWilson

New Member
Joined
Dec 12, 2017
Messages
3
From these eight numbers 7, 6, 6, 5, 4, 4, 3, 2. Using only 5 of the 8 numbers what combinations equal sum of 23 or less?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
AWilson, Welcome to the forum.

lhartono, I'm not sure how you arrived at that number. The number of combinations of 8 things taken 5 at a time is C(8,5) = 56. Of those 56, some will sum to over 23. I get a count of 31 combinations. And even of that 31, some of them appear to be duplicates, due to the duplicate values in the original list. If we want those eliminated too, I get only 17 combinations.

AWilson, why do you need this? Do you want formulas, VBA, or just an explanation of the math?
 
Upvote 0
Thanks Eric! I knew 330 was not correct. Actually this is what it's for.. We play on a pool league with a very important tournament this weekend. We have 8 players with the following skill levels (7, 6, 6, 5, 4, 4, 3, 2). Only 5 out of 8 play in a match. Skill level combination can not be more than 23. I was just trying to make me an easy reference sheet to use on Saturday of the different combinations of which players we can use each match. I'm ok in Excel but when I started trying to figure this out I just went into beginner mode. LOL So.. I need a sheet with the different combinations. You can tell me how to do it and I will do it myself or just however you would like! Thanks so much!!
 
Upvote 0
So in this case, the 4s and 6s must be considered as unique, since they refer to different people. In that case, try:

ABCDEFGHI
170000000212RowCombinationSum
260000003013310005443218
360000003225470060443219
450000040014550065043220
540000040226590065403220
640000043027610065440221
730000043239620065443022
820000400014790600443219
90000400226870605043220
100000403027910605403220
110000403239930605440221
120000440028940605443022
13000044023101030660043221
14000044303111070660403221
15000044324131090660440222
1600050000151100660443023
1700050002271150665003222
1800050030281170665040223
19000500323101210665400223
2000050400291437000443220
21000504023111517005043221
22000504303121557005403221
23000504324141577005440222
2400054000291587005443023
25000540023111677060043222
26000540303121717060403222
27000540324141737060440223
28000544003131797065003223
29000544024151997600043222
30000544304162037600403222
31000544325182057600440223
3200600000162117605003223
330060000228
340060003029

<tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
C1=TEXT(MMULT(10^{7,6,5,4,3,2,1,0},MID(DEC2BIN(ROW(),8),{1;2;3;4;5;6;7;8},1)*$A$1:$A$8),"00000000")
D1=LEN(SUBSTITUTE(C1,"0",""))
E1=SUM(MID(C1,{1,2,3,4,5,6,7,8},1)+0)
H2=IF(G2="","",INDEX(C:C,G2))
I2=IF(G2="","",INDEX(E:E,G2))

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
G2{=IFERROR(SMALL(IF($D$1:$D$255=5,IF($E$1:$E$255<=23,ROW($D$1:$D$255))),ROWS($G$2:$G2)),"")}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>




Put your list of players in A1:A8. Then put the C1:E1 formulas in. Now copy C1:E1, and copy them down the columns to row 255. Column C contains every combination of your 8 players, with 0 meaning "not in this combination". D is the number of players in the combination, and E is the sum of the skill levels. Now put the headings in G1:I1. Put the G2:I2 formulas in (G2 is an array formula), then copy them down to row 32. These formulas just search through the table in C1:E255 to find valid combinations.

Of course, you can just copy columns H and I - they contain the full list.

Good luck!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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