View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ryan Sheehy Ryan Sheehy is offline
external usenet poster
 
Posts: 4
Default Array Combinations with a Twist

I'm trying to rack my brain over this little problem...

I have an array that contains words from a string. As an example, if a
string has the following (without the quotes): "The quick brown fox"
the array would contain only the elements (without the quotes) "The",
"quick", "brown", "fox".

What I would like to do is to output all possible combinations of
those 4 array elements as ONE string (with the spaces returned)
without repeating the same word twice in that string. To continue on
with our example... some of the results would be: "The fox brown
quick", or, "brown The fox quick" etc...

I know of the Join(x, " ") function that can help me stick the array
elements back together as one string with spaces, but how do I do the
combination process?

One last important aspect: The number of words in a string (the
quantity of elements in the array) can be any length, but generally
there is a minimum of at least 2 words, and a maximum of 10.

Any help greatly appreciated.


Ryan