Truth Table

V

Victoria612

OK - I have 6 questions, all of which can be answered either yes or no. Is
there a way to build a macro that can determine all 36 possible scenarios for
me?

For example:
1 Yes Yes Yes
2 No Yes Yes
3 No No Yes
4 No No No
5 No No No
6 No No No

.....and so on.

We can use other values for Yes and No, say True or False, or "1" or "0",
respectively.

Any help is greatly appreciated.

Victoria
 
J

Jacob Skaria

27 possibilities...

Sub Macro()
Dim lngRow As Long
Dim intA As Integer, intB As Integer, intC As Integer

For intA = 1 To 3
For intB = 1 To 3
For intC = 1 To 3
lngRow = lngRow + 1
Range("A" & lngRow).Resize(, 3) = Split(intA & "," & intB & "," & intC, ",")
Next
Next
Next
End Sub
 
T

Tom-S

Sorry haven't checked your code. I was just thinking since the 64
combinations are actually binary representations of the decimal numbers 0 to
63, isn't there a function for converting these? Then just split the binary
into the appropriate cells.

On the maths side, since each place location in the binary number can take
either 1 or 0, then the total number of combinations in a 6-figure number is
2 to the power 6 = 64

Regards,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top