all combinations without repeats

RICH1980

New Member
Joined
Feb 5, 2011
Messages
15
Hi, I am unsure if this already exists but have spent days looking for what I need and cannot find it.

What I am looking for is a VBA that will provide all possible unique combinations within a range.

The range will be variable to input - in column A from 1 to 12 entries.

Lets say-

A1 - cat
A2 - dog
A3 - cow
A4 - pig

Without repetition I would like it come back with the possible combinations up to 12 entries, ideally in separate cell.

b1 cat
b2 cat c3 dog
b3 cat c3 dog d3 cow
b4 cat c4 dog d4 cow e4 pig

In this case

b2 dog and c3 cat would be the same as above and not needed as not a unique combination.

Any ideas, thanks in advance
 
Hi

I'm still working on this.

This is only part of what I need really but it would really be of help with amending it.

a) I would like for the array to be linked to a range c3:c8 and ignore blanks
b) I would like the combinations to be in different cells - rather the same one as I need to look up values from a cell fomula.
c) If possible - to have have a gap of two rows between each combination set.

The 'loans' below are in a table - the amount of loans will vary.




Sub MAIN()
B = Array("Loan 1", "Loan 2", "Loan 3", "Loan 4", "Loan 5", "Loan 6")
Call GrayCode(B)
End Sub

Function GrayCode(Items As Variant) As String
Dim CodeVector() As Integer
Dim i, kk As Integer
Dim lower As Integer, upper As Integer
Dim SubList As String
Dim NewSub As String
Dim done As Boolean
Dim OddStep As Boolean
kk = 2
OddStep = True
lower = LBound(Items)
upper = UBound(Items)
ReDim CodeVector(lower To upper) 'it starts all 0
Do Until done
'Add a new subset according to current contents
'of CodeVector
NewSub = ""
For i = lower To upper
If CodeVector(i) = 1 Then
If NewSub = "" Then
NewSub = "," & Items(i)
Else
NewSub = NewSub & Items(i)
End If
End If
Next i
If NewSub = "" Then NewSub = "{}" 'empty set
SubList = SubList & vbCrLf & NewSub
Cells(30, kk) = Mid(NewSub, 2)
kk = kk + 1
'now update code vector
If OddStep Then
'just flip first bit
CodeVector(lower) = 1 - CodeVector(lower)
Else
'first locate first 1
i = lower
Do While CodeVector(i) <> 1
i = i + 1
Loop
'done if i = upper:
If i = upper Then
done = True
Else
'if not done then flip the *next* bit:
i = i + 1
CodeVector(i) = 1 - CodeVector(i)
End If
End If
OddStep = Not OddStep 'toggles between even and odd steps
Loop
GrayCode = SubList
End Function
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi

thanks, the combinations were limited; some where missing.

my latest one kinda works but needs adapting.
 
Upvote 0
Perhaps this might help !!!
Your data in "C3:C8", Results Start "E1".
Code:
[COLOR="Navy"]Sub[/COLOR] MG26Apr32
[COLOR="Navy"]Dim[/COLOR] Dn [COLOR="Navy"]As[/COLOR] Range, Rng [COLOR="Navy"]As[/COLOR] Range, Dic [COLOR="Navy"]As[/COLOR] Object, c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] rRng [COLOR="Navy"]As[/COLOR] Range, p, n, nRay, w [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] vElements, lRow [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] vresult [COLOR="Navy"]As[/COLOR] Variant
nRay = Range(Range("C3"), Range("C" & Rows.Count).End(xlUp))
c = 1
[COLOR="Navy"]For[/COLOR] n = 1 To UBound(nRay)
    vElements = Application.Transpose(nRay)
        ReDim vresult(1 To n)
            Call CombinationsNP(vElements, CInt(n), vresult, lRow, 1, 1, c)
[COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]

[COLOR="Navy"]Sub[/COLOR] CombinationsNP(vElements [COLOR="Navy"]As[/COLOR] Variant, p [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer,[/COLOR] vresult [COLOR="Navy"]As[/COLOR] Variant, lRow [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] iElement [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer,[/COLOR] iIndex [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer,[/COLOR] c)
[COLOR="Navy"]Dim[/COLOR] i [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer[/COLOR]

[COLOR="Navy"]For[/COLOR] i = iElement To UBound(vElements)
    vresult(iIndex) = vElements(i)
    [COLOR="Navy"]If[/COLOR] iIndex = p [COLOR="Navy"]Then[/COLOR]
        lRow = lRow + 1
         
         Range("E" & c).Resize(, UBound(vresult)).Value = vresult
        c = c + 3
    [COLOR="Navy"]Else[/COLOR]
        Call CombinationsNP(vElements, p, vresult, lRow, i + 1, iIndex + 1, c)
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] i
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Hi, thanks.

Very quick. Work great.

I'm working on, what for me is complex, so hopefully this will aide with the first step.

Ieally i need this part to go across rather than down - as the next step (if this bit works) is to have another combination vba for an array above each combination.

Thank you so much
 
Upvote 0
Try this for results going across columns starting in "E1".
Code:
[COLOR="Navy"]Sub[/COLOR] MG26Apr48

[COLOR="Navy"]Dim[/COLOR] Dn [COLOR="Navy"]As[/COLOR] Range, Rng [COLOR="Navy"]As[/COLOR] Range, Dic [COLOR="Navy"]As[/COLOR] Object, c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] rRng [COLOR="Navy"]As[/COLOR] Range, p, n, nRay, w [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] vElements, lRow [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] vresult [COLOR="Navy"]As[/COLOR] Variant
nRay = Range(Range("C3"), Range("C" & Rows.Count).End(xlUp))
c = 5
[COLOR="Navy"]For[/COLOR] n = 1 To UBound(nRay)
    vElements = Application.Transpose(nRay)
        ReDim vresult(1 To n)
            Call CombinationsNP(vElements, CInt(n), vresult, lRow, 1, 1, c)
[COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]

[COLOR="Navy"]Sub[/COLOR] CombinationsNP(vElements [COLOR="Navy"]As[/COLOR] Variant, p [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer,[/COLOR] vresult [COLOR="Navy"]As[/COLOR] Variant, lRow [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] iElement [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer,[/COLOR] iIndex [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer,[/COLOR] c)
[COLOR="Navy"]Dim[/COLOR] i [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer[/COLOR]

[COLOR="Navy"]For[/COLOR] i = iElement To UBound(vElements)
    vresult(iIndex) = vElements(i)
    [COLOR="Navy"]If[/COLOR] iIndex = p [COLOR="Navy"]Then[/COLOR]
        lRow = lRow + 1
         '[COLOR="Green"][B] Range("E" & c).Resize(, UBound(vresult)).Value = vresult[/B][/COLOR]
         Cells(1, c).Resize(UBound(vresult)).Value = Application.Transpose(vresult)
         c = c + 3
    [COLOR="Navy"]Else[/COLOR]
        Call CombinationsNP(vElements, p, vresult, lRow, i + 1, iIndex + 1, c)
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] i
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
There's a workbook at https://app.box.com/s/b9b9fc06beb63b9562f9 that will do this:

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
2​
[/td][td="bgcolor:#F3F3F3"]
n​
[/td][td="bgcolor:#909090"][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
3​
[/td][td="bgcolor:#E5E5E5"]
7​
[/td][td="bgcolor:#909090"][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
4​
[/td][td="bgcolor:#F3F3F3"]
mMin​
[/td][td="bgcolor:#909090"][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
5​
[/td][td]
1
[/td][td="bgcolor:#909090"][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
6​
[/td][td="bgcolor:#F3F3F3"]
mMax​
[/td][td="bgcolor:#909090"][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
7​
[/td][td]
6
[/td][td="bgcolor:#909090"][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
8​
[/td][td="bgcolor:#F3F3F3"]
nComb​
[/td][td="bgcolor:#909090"][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
9​
[/td][td="bgcolor:#E7E7E7"]
126​
[/td][td="bgcolor:#909090"][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
10​
[/td][td="bgcolor:#909090"][/td][td="bgcolor:#909090"][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
11​
[/td][td="bgcolor:#F3F3F3"]
m​
[/td][td]Ant Bee Cow Dog Emu Flea Gnat[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
12​
[/td][td]
1​
[/td][td]Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
13​
[/td][td]
1​
[/td][td]Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
14​
[/td][td]
1​
[/td][td]Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
15​
[/td][td]
1​
[/td][td]Dog[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
16​
[/td][td]
1​
[/td][td]Emu[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
17​
[/td][td]
1​
[/td][td]Flea[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
18​
[/td][td]
1​
[/td][td]Gnat[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
19​
[/td][td]
2​
[/td][td]Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
20​
[/td][td]
2​
[/td][td]Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
21​
[/td][td]
2​
[/td][td]Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
22​
[/td][td]
2​
[/td][td]Dog Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
23​
[/td][td]
2​
[/td][td]Dog Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
24​
[/td][td]
2​
[/td][td]Dog Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
25​
[/td][td]
2​
[/td][td]Emu Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
26​
[/td][td]
2​
[/td][td]Emu Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
27​
[/td][td]
2​
[/td][td]Emu Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
28​
[/td][td]
2​
[/td][td]Emu Dog[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
29​
[/td][td]
2​
[/td][td]Flea Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
30​
[/td][td]
2​
[/td][td]Flea Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
31​
[/td][td]
2​
[/td][td]Flea Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
32​
[/td][td]
2​
[/td][td]Flea Dog[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
33​
[/td][td]
2​
[/td][td]Flea Emu[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
34​
[/td][td]
2​
[/td][td]Gnat Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
35​
[/td][td]
2​
[/td][td]Gnat Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
36​
[/td][td]
2​
[/td][td]Gnat Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
37​
[/td][td]
2​
[/td][td]Gnat Dog[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
38​
[/td][td]
2​
[/td][td]Gnat Emu[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
39​
[/td][td]
2​
[/td][td]Gnat Flea[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
40​
[/td][td]
3​
[/td][td]Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
41​
[/td][td]
3​
[/td][td]Dog Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
42​
[/td][td]
3​
[/td][td]Dog Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
43​
[/td][td]
3​
[/td][td]Dog Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
44​
[/td][td]
3​
[/td][td]Emu Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
45​
[/td][td]
3​
[/td][td]Emu Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
46​
[/td][td]
3​
[/td][td]Emu Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
47​
[/td][td]
3​
[/td][td]Emu Dog Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
48​
[/td][td]
3​
[/td][td]Emu Dog Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
49​
[/td][td]
3​
[/td][td]Emu Dog Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
50​
[/td][td]
3​
[/td][td]Flea Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
51​
[/td][td]
3​
[/td][td]Flea Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
52​
[/td][td]
3​
[/td][td]Flea Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
53​
[/td][td]
3​
[/td][td]Flea Dog Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
54​
[/td][td]
3​
[/td][td]Flea Dog Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
55​
[/td][td]
3​
[/td][td]Flea Dog Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
56​
[/td][td]
3​
[/td][td]Flea Emu Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
57​
[/td][td]
3​
[/td][td]Flea Emu Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
58​
[/td][td]
3​
[/td][td]Flea Emu Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
59​
[/td][td]
3​
[/td][td]Flea Emu Dog[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
60​
[/td][td]
3​
[/td][td]Gnat Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
61​
[/td][td]
3​
[/td][td]Gnat Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
62​
[/td][td]
3​
[/td][td]Gnat Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
63​
[/td][td]
3​
[/td][td]Gnat Dog Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
64​
[/td][td]
3​
[/td][td]Gnat Dog Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
65​
[/td][td]
3​
[/td][td]Gnat Dog Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
66​
[/td][td]
3​
[/td][td]Gnat Emu Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
67​
[/td][td]
3​
[/td][td]Gnat Emu Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
68​
[/td][td]
3​
[/td][td]Gnat Emu Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
69​
[/td][td]
3​
[/td][td]Gnat Emu Dog[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
70​
[/td][td]
3​
[/td][td]Gnat Flea Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
71​
[/td][td]
3​
[/td][td]Gnat Flea Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
72​
[/td][td]
3​
[/td][td]Gnat Flea Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
73​
[/td][td]
3​
[/td][td]Gnat Flea Dog[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
74​
[/td][td]
3​
[/td][td]Gnat Flea Emu[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
75​
[/td][td]
4​
[/td][td]Dog Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
76​
[/td][td]
4​
[/td][td]Emu Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
77​
[/td][td]
4​
[/td][td]Emu Dog Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
78​
[/td][td]
4​
[/td][td]Emu Dog Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
79​
[/td][td]
4​
[/td][td]Emu Dog Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
80​
[/td][td]
4​
[/td][td]Flea Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
81​
[/td][td]
4​
[/td][td]Flea Dog Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
82​
[/td][td]
4​
[/td][td]Flea Dog Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
83​
[/td][td]
4​
[/td][td]Flea Dog Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
84​
[/td][td]
4​
[/td][td]Flea Emu Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
85​
[/td][td]
4​
[/td][td]Flea Emu Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
86​
[/td][td]
4​
[/td][td]Flea Emu Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
87​
[/td][td]
4​
[/td][td]Flea Emu Dog Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
88​
[/td][td]
4​
[/td][td]Flea Emu Dog Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
89​
[/td][td]
4​
[/td][td]Flea Emu Dog Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
90​
[/td][td]
4​
[/td][td]Gnat Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
91​
[/td][td]
4​
[/td][td]Gnat Dog Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
92​
[/td][td]
4​
[/td][td]Gnat Dog Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
93​
[/td][td]
4​
[/td][td]Gnat Dog Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
94​
[/td][td]
4​
[/td][td]Gnat Emu Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
95​
[/td][td]
4​
[/td][td]Gnat Emu Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
96​
[/td][td]
4​
[/td][td]Gnat Emu Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
97​
[/td][td]
4​
[/td][td]Gnat Emu Dog Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
98​
[/td][td]
4​
[/td][td]Gnat Emu Dog Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
99​
[/td][td]
4​
[/td][td]Gnat Emu Dog Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
100​
[/td][td]
4​
[/td][td]Gnat Flea Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
101​
[/td][td]
4​
[/td][td]Gnat Flea Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
102​
[/td][td]
4​
[/td][td]Gnat Flea Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
103​
[/td][td]
4​
[/td][td]Gnat Flea Dog Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
104​
[/td][td]
4​
[/td][td]Gnat Flea Dog Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
105​
[/td][td]
4​
[/td][td]Gnat Flea Dog Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
106​
[/td][td]
4​
[/td][td]Gnat Flea Emu Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
107​
[/td][td]
4​
[/td][td]Gnat Flea Emu Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
108​
[/td][td]
4​
[/td][td]Gnat Flea Emu Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
109​
[/td][td]
4​
[/td][td]Gnat Flea Emu Dog[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
110​
[/td][td]
5​
[/td][td]Emu Dog Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
111​
[/td][td]
5​
[/td][td]Flea Dog Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
112​
[/td][td]
5​
[/td][td]Flea Emu Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
113​
[/td][td]
5​
[/td][td]Flea Emu Dog Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
114​
[/td][td]
5​
[/td][td]Flea Emu Dog Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
115​
[/td][td]
5​
[/td][td]Flea Emu Dog Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
116​
[/td][td]
5​
[/td][td]Gnat Dog Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
117​
[/td][td]
5​
[/td][td]Gnat Emu Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
118​
[/td][td]
5​
[/td][td]Gnat Emu Dog Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
119​
[/td][td]
5​
[/td][td]Gnat Emu Dog Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
120​
[/td][td]
5​
[/td][td]Gnat Emu Dog Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
121​
[/td][td]
5​
[/td][td]Gnat Flea Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
122​
[/td][td]
5​
[/td][td]Gnat Flea Dog Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
123​
[/td][td]
5​
[/td][td]Gnat Flea Dog Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
124​
[/td][td]
5​
[/td][td]Gnat Flea Dog Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
125​
[/td][td]
5​
[/td][td]Gnat Flea Emu Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
126​
[/td][td]
5​
[/td][td]Gnat Flea Emu Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
127​
[/td][td]
5​
[/td][td]Gnat Flea Emu Cow Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
128​
[/td][td]
5​
[/td][td]Gnat Flea Emu Dog Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
129​
[/td][td]
5​
[/td][td]Gnat Flea Emu Dog Bee[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
130​
[/td][td]
5​
[/td][td]Gnat Flea Emu Dog Cow[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
131​
[/td][td]
6​
[/td][td]Flea Emu Dog Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
132​
[/td][td]
6​
[/td][td]Gnat Emu Dog Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
133​
[/td][td]
6​
[/td][td]Gnat Flea Dog Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
134​
[/td][td]
6​
[/td][td]Gnat Flea Emu Cow Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
135​
[/td][td]
6​
[/td][td]Gnat Flea Emu Dog Bee Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
136​
[/td][td]
6​
[/td][td]Gnat Flea Emu Dog Cow Ant[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
137​
[/td][td]
6​
[/td][td]Gnat Flea Emu Dog Cow Bee[/td][/tr]
[/table]


You can use text to columns to split them to separate cells.
 
Upvote 0
Hi Mick

You are a complete legend. This works perfect. thank you.

I've put an array above each calculation. I'm thinking of opening a new thread for the next step - as although still a combination thread - this will be for multiple ranges (well up to 63 ranges)

Thanks again
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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