#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Truth Table

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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Truth Table

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

--
Jacob (MVP - Excel)


"Victoria612" wrote:

I stand corrected - is there a way to program a macro that can determine all
72 possible scenarios?

"Victoria612" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 66
Default Truth Table

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


"Victoria612" wrote:

WAIT! I think I got it - can someone confirm this is accurate?

Sub Macro()
Dim lngRow As Long
Dim intA As Integer, intB As Integer, intC As Integer, intD As Integer, intE
As Integer, intF As Integer
For intA = 1 To 2
For intB = 1 To 2
For intC = 1 To 2
For intD = 1 To 2
For intE = 1 To 2
For intF = 1 To 2
lngRow = lngRow + 1
Range("A" & lngRow).Resize(, 6) = Split(intA & "," & intB & "," & intC & ","
& intD & "," & intE & "," & intF, ",")
Next
Next
Next
Next
Next
Next
End Sub

Also, can someone explain why there are 64 total scenarios? For some reason
I was convinced it was 36 (6 to the n power, n being the number of possible
answers, which in this case is 2)

Thank you.

"Victoria612" wrote:

Thank you Jacob:
OK - I ran the macro and it resulted in a three column table of 27
rows....My apologies if I did not explain my intentions correctly..
I have 6 questions that may be answered yes or no, and for the sake of
keeping everything in integer form, let's assume "1" for yes and "0" for no.
Depending on how a customer answers all 6 questions, they will receive a
predetermined score. I am attempting to develop the answer key, so-to-speak,
to refer the reps to once they are finished asking the customer these
questions.
I was hoping for a table that would lay out all of the 6 question-answer
combinations, like the following:
Questions Scenario 1 Scenario 2 Scenario 3 Scenario 4
1 1 1 1
1
2 1 0 0
0
3 1 1 0
1
4 1 1 1
0
5 1 1 1
1
6 1 1 1
1

...and so on, so that I am given all the possible 6 answer
scenarios....Hopefully this helps out. Is it still only 27 possibilities? I
thought, at the very least, 36€¦, no?
Your help is greatly appreciated!
Victoria

"Jacob Skaria" wrote:

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

--
Jacob (MVP - Excel)


"Victoria612" wrote:

I stand corrected - is there a way to program a macro that can determine all
72 possible scenarios?

"Victoria612" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Truth Table in Excel JimS Excel Discussion (Misc queries) 10 April 22nd 23 08:12 AM
Truth Table Victoria612 Excel Worksheet Functions 0 May 27th 10 09:43 PM
Truth Table Victoria612 Excel Worksheet Functions 0 May 27th 10 09:30 PM
Truth Table Victoria612 Excel Worksheet Functions 0 May 27th 10 09:16 PM
Looking for the truth !! Decreenisi Excel Worksheet Functions 2 January 10th 06 12:39 PM


All times are GMT +1. The time now is 11:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"