LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
bj
 
Posts: n/a
Default

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.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Seed numbers for random number generation, uniform distribution darebo Excel Discussion (Misc queries) 3 April 21st 23 09:02 PM
How to format a number in Indian style in Excel? Victor_alb Excel Discussion (Misc queries) 2 December 21st 04 04:21 AM
Defining a number in a cell by text then subtracting it by the tex Crowraine Excel Worksheet Functions 1 December 16th 04 07:49 AM
multiply by actual number in cell CJ Cerezo Excel Worksheet Functions 3 November 29th 04 09:43 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 04:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"