3 combinations out of 5 for WPS Office

panyagak

Active Member
Joined
Feb 24, 2017
Messages
299
Hi All.

ok i have, just an eg. of 5 selections out of which only 3 combinations interest me. how many combinations would there be leaving out 2 totally different selections.
List:

Thee
Pluto
Iruma
****
Elite.

with regards
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
In case you wanted to display the possible combinations, I found some interesting UDFs at this page: Return all combinations. Put the code in a standard module.
VBA Code:
Public result() As Variant
Function Combinations(rng As Range, n As Single)
    rng1 = rng.Value
    ReDim result(n - 1, 0)
    Call Recursive(rng1, n, 1, 0)
    ReDim Preserve result(UBound(result, 1), UBound(result, 2) - 1)
    Combinations = Application.Transpose(result)
End Function

Function Recursive(r As Variant, c As Single, d As Single, e As Single)
    Dim f As Single
    For f = d To UBound(r, 1)
        result(e, UBound(result, 2)) = r(f, 1)
        If e = (c - 1) Then
            ReDim Preserve result(UBound(result, 1), UBound(result, 2) + 1)
            For g = 0 To UBound(result, 1)
                result(g, UBound(result, 2)) = result(g, UBound(result, 2) - 1)
            Next g
        Else
            Call Recursive(r, c, f + 1, e + 1)
        End If
    Next f
End Function

Used like this:
Book1
ABCD
3TheeTheePlutoIruma
4PlutoTheePluto****
5IrumaTheePlutoElite.
6****TheeIruma****
7Elite.TheeIrumaElite.
8Thee****Elite.
9PlutoIruma****
10PlutoIrumaElite.
11Pluto****Elite.
12Iruma****Elite.
Sheet2
Cell Formulas
RangeFormula
B3:D12B3=Combinations(A3:A7,3)
Dynamic array formulas.
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Fluff

am currently using WPS on my 2G smartphone.

Version MS 10/13 on PC occasionally.

thanks
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,659
Members
449,462
Latest member
Chislobog

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