View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RADO[_3_] RADO[_3_] is offline
external usenet poster
 
Posts: 79
Default Need help with algorithm

I am stuck, will much appreciate advice.

I have several vertical ranges with several values in each. I need to
construct their possible combinations. For example, if range 1 contains
values 1, 2 , range 2 : A, B, range 3: X, Y, Z then the result should look
like this:

1 A X
1 A Y
1 A Z
1 B X
1 B Y
1 B Z
2 A X
2 A Y
2 A Z
2 B X
2 B Y
2 B Z

I am trying to come up with a general algorithm to construct this output in
Excel (because I don't know the number of ranges and number of values in
them in advance, they vary). It looks like a job for the recursion, but I
could not figure out how. Please help!

Thanks in advance -
RADO