ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find the possibilities (https://www.excelbanter.com/excel-programming/297150-find-possibilities.html)

BlackBlade[_2_]

find the possibilities
 
Dear friends,
lets say i have 6 numbers. if i take 4 numbers out of the 6 at a time and
multiply them i know i have 15 possible series of the 4 numbers. Is there a
way by vba in excel to have all the possible 4pairs multiplations?

for example
a1 10 1st match = a1*a2*a3*a4
a2 9 2nd match= a2*a3*a4*a5
a3 7 3rd match =a3*a4*a5*a6
a4 5 4th .....
a5 4 15th....=a1*a4*a5*a6
a6 3

is it possible to have all matches with a click?how?
thanks in advance!



Cecilkumara Fernando[_2_]

find the possibilities
 
BlackBlade,
Try this

Sub dd()
For i = 1 To 3
For j = i + 1 To 4
For k = j + 1 To 5
For m = k + 1 To 6
n = n + 1
Cells(n, 2).Value = Cells(i, 1) * _
Cells(j, 1) * Cells(k, 1) * Cells(m, 1)

Next
Next
Next
Next
End Sub

Cecil

"BlackBlade" wrote in message
...
Dear friends,
lets say i have 6 numbers. if i take 4 numbers out of the 6 at a time and
multiply them i know i have 15 possible series of the 4 numbers. Is there

a
way by vba in excel to have all the possible 4pairs multiplations?

for example
a1 10 1st match = a1*a2*a3*a4
a2 9 2nd match= a2*a3*a4*a5
a3 7 3rd match =a3*a4*a5*a6
a4 5 4th .....
a5 4 15th....=a1*a4*a5*a6
a6 3

is it possible to have all matches with a click?how?
thanks in advance!





BlackBlade[_2_]

find the possibilities
 
Thanks a lot my friend. It works fine. I adjusted it the way i want it and
its perfect. Thanks my friend
Ο "Cecilkumara Fernando" <cekufdo@sltnetDOTlk έγραψε στο μήνυμα
...
BlackBlade,
Try this

Sub dd()
For i = 1 To 3
For j = i + 1 To 4
For k = j + 1 To 5
For m = k + 1 To 6
n = n + 1
Cells(n, 2).Value = Cells(i, 1) * _
Cells(j, 1) * Cells(k, 1) * Cells(m, 1)

Next
Next
Next
Next
End Sub

Cecil

"BlackBlade" wrote in message
...
Dear friends,
lets say i have 6 numbers. if i take 4 numbers out of the 6 at a time

and
multiply them i know i have 15 possible series of the 4 numbers. Is

there
a
way by vba in excel to have all the possible 4pairs multiplations?

for example
a1 10 1st match = a1*a2*a3*a4
a2 9 2nd match= a2*a3*a4*a5
a3 7 3rd match =a3*a4*a5*a6
a4 5 4th .....
a5 4 15th....=a1*a4*a5*a6
a6 3

is it possible to have all matches with a click?how?
thanks in advance!








All times are GMT +1. The time now is 07:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com