trifecta output

barneyboy

Board Regular
Joined
Feb 28, 2009
Messages
71
Hello. I'd like to display the combinations of a set of numbers in column A into columns B,C and D. eg: in column A1 to A6 I'd have the numbers 1,2,3,4,5 and 6.
there are 120 combinations of these numbers for a trifecta starting with 1,2,3 and ending with 6,5,4.
Is there a way to express these 120 combinations in columns BCD eg.
the first combination of 1,2,3 would appear in columns B1,C1 and D1 and the rest so on down the spreadsheet.
hope I've made it understandable.

Regards,

barneyboy
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
try this
Code:
Sub Test()
For B = 1 To 6
    For C = 1 To 6
        For D = 1 To 6
            If B <> C And C <> D And B <> D Then
                N = N + 1
                Cells(N, 2) = B
                Cells(N, 3) = C
                Cells(N, 4) = D
            End If
        Next D
    Next C
Next B
End Sub
 
Upvote 0
hello, Sal P. No, it will not always be six numbers. Sometimes 4,5 or even 7 or 8 numbers. I do have a formula to include in another column which references the odds that I assign to nos 1 to six in column A
I suppose I am looking for a macro but I don't know how to do it.

Thanks, Grizz, for your reply. I'll try to give it a go.

Many thanks for your replys, guys.

Regards,

Barneyboy
 
Upvote 0
Grizz's formula will do it for 6, but if it's going to be a variable amount, you need to replace 6 with a variable that counts the number of entries in your A column.
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,849
Members
452,948
Latest member
UsmanAli786

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