Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I do this type of operation fairly regularily
enter 1 thr 9 in cells A1 to A9 copy these cells and paste to A1:A81 copy A1:A81 and paste to B1:B81 Sort Column A by itself copy A1:B81 and paste to A1:B729 Copy B1:B729 and paste to C1:C729 Sort Column B by itself Copy A1:C729 and paste to A1:C6561 Copy C1:C6561 and paste to D1:D6561 Sort Column C by itself in Cell E1 enter =if(or(A1=B1,A1=C1,A1=D1,B1=C1,B1=D1,C1=D1),1,0) Copy E1 and paste to E1:E6561 Select Columns A:E and sort by column E Delete all of the Rows with a 1 in column E. (I would check that My 9 to the powers numbers are correct) There are, of course many ways to do this. By the time you get to about 6 combos, You run out of rows if you dont delete between steps in that Case I would use a macro similer to sub ser4() r=1 for J = 1 to 9 for j = 1 to 9 if j=i then goto 53 for k = 1 to 9 if k = i or k = j then goto 52 for m = 1 to 9 if m = i or m = j or m = k then goto 51 cells(r,1)=i:cells(r,2)=j:Cells(r,3)=k:cells(r,4)= m:r=r+1 51 next m 52 next k 53 next j next i end sub Please note this is what I call a brute force sub. It is what I would do for doing something simple once. If you are going to do something a bunch or if others will be running a sub or if the sub is complex. it is best to "dim" everything and use option explicit etc and put in comments to explain what you are doing. "pav55" wrote: I have theses numbers:- 1, 2, 3, 4, 5, 6, 7, 8, 9 and I need to work out all the combinations these numbers have in sets of 4. By this I mean for example, 1234, 1236 etc....using each number once in a set..(so there are no duplicates) i.e. Not 1124. Is there any worksheet function/formula I could make in excel to work out and hence display all the possible four set combinations there are? But not the total of combinations i.e. just one number..because I already know how to calculate the number of combinations there can be. Or is there any alternatives other than writing them all out by hand?! Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Seed numbers for random number generation, uniform distribution | Excel Discussion (Misc queries) | |||
How to format a number in Indian style in Excel? | Excel Discussion (Misc queries) | |||
Defining a number in a cell by text then subtracting it by the tex | Excel Worksheet Functions | |||
multiply by actual number in cell | Excel Worksheet Functions | |||
GET.CELL | Excel Worksheet Functions |