View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Solving the 'CLUE' Murder

Run this macro:

Sub ordinate()
s = Array("Plum", "Green", "Violet", "Mustard")
t = Array("Kitchen", "Dinning Room", "Living Room", "Library")
u = Array("Candlestick", "Gun", "Knife", "Rope")
l = 1
For i = 0 To 3
For j = 0 To 3
For k = 0 To 3
Cells(l, 1).Value = s(i) & " in the " & t(j) & " with a " & u(k)
l = l + 1
Next
Next
Next
End Sub

--
Gary''s Student - gsnu200777


"DaleFlyFisher" wrote:

I think the best way to express my problem is to reference the Clue game.
You have one list of possible murderers, one list of possible rooms and one
list of possible murder weapons. How do I write a function to solve for all
possible answers?

Column A Column B Column C
Plum Kitchen Candlestick
Green Dining Room Gun
Violet Living Room Knife
Mustard Library Rope

I could write out multiple functions, (A1,"in the",B1,"with the",C1);
(A1,"in the",B2,"with the",C1); (A1,"in the",B3,"with the",C1) and so on.
But is there an easier way to find all possible combinations?

Thanks for your help,
DaleFlyFisher