Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Macro to build table

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:

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 the code that would build a macro to create this tabe for
me - 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....

Your help is greatly appreciated!

Victoria


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Macro to build table

It worked ok for me.

If you have two options and each option has 2 choices, then you'll end up with
2^2=4.
AA
AB
BA
BB

If you have 3 options and each option has 2 choices, then you'll end up with
2^3=8.

AAA
AAB
ABA
BAA
ABB
BAB
BBA
BBB

So the rule would be 2 (the number of choices) raised to the number of options.

=2^6=64

Take a look at your output and you'll see all those possibilities.

Victoria612 wrote:

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:

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 the code that would build a macro to create this tabe for
me - 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....

Your help is greatly appreciated!

Victoria



--

Dave Peterson
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
Help to build a table Mary Excel Discussion (Misc queries) 5 March 5th 10 07:14 PM
Build a Table jxbeeman Excel Discussion (Misc queries) 2 August 12th 09 11:19 PM
How do I build a sensitivity analysis table? OS Excel Worksheet Functions 1 September 12th 07 08:55 PM
Match 2 sheet and build table npereira Excel Discussion (Misc queries) 9 August 11th 06 07:35 PM
How do I build this Macro? Omakbob Excel Discussion (Misc queries) 4 September 28th 05 09:26 PM


All times are GMT +1. The time now is 05:28 AM.

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

About Us

"It's about Microsoft Excel"