Solving the 'CLUE' Murder
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 |
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 |
Solving the 'CLUE' Murder
Thank you "Gary"s Student".
If there are dozens of cells in each column, do I have to write out each and every cell value in the macro? And can the results be made to appear in a column other than Column A? Thanks again, DaleFlyFisher "Gary''s Student" wrote: 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 |
All times are GMT +1. The time now is 04:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com