|
-
May 18th, 2005, 07:48 PM
#1
Thread Starter
Member
formula needed...
Hi, I have been racking my brain over this simple problem, but I don't seem to be able to get it right.
I have two incrementing variables.
The variables are:
intRunDiff
intRunCount
what I have is this:
VB Code:
For intRunCount = 1 To 6
For intRunDiff = 1 To intWhatever
<insert formula here>
Next intRunDiff
Next intRunCount
The results should look like this:
Code:
intRunDiff 1 2 3 4 5 6 7 8 ...
intRunCount
1 1 6 5 4 3 2 1 6 ...
2 2 1 6 5 4 3 ...
3 3 2 1 6 5 4 ...
4 4 3 2 1 6 5 ...
5 5 4 3 2 1 6 ...
6 6 5 4 3 2 1 ...
-
May 18th, 2005, 08:05 PM
#2
Re: formula needed...
I'll let you work out the formatting. I think this is the right sequence, though.
VB Code:
Option Explicit
Private Sub Form_Load()
Dim intRunCount%, intRunDiff%, intWhatever%, x%
intWhatever = 8
For intRunCount = 1 To 6
Debug.Print vbCrLf & intRunCount & " ";
For x = intRunCount To 1 Step -1
Debug.Print " " & x;
Next x
x = 0
For intRunDiff = 1 To intWhatever
If x < intWhatever - intRunCount - 1 Then
Debug.Print " " & intWhatever - intRunDiff;
x = x + 1
End If
Next intRunDiff
Next intRunCount
End Sub
1 1 7 6 5 4 3 2
2 2 1 7 6 5 4 3
3 3 2 1 7 6 5 4
4 4 3 2 1 7 6 5
5 5 4 3 2 1 7 6
6 6 5 4 3 2 1 7
-
May 18th, 2005, 08:21 PM
#3
Thread Starter
Member
Re: formula needed...
ah i think i have led u astray.
when i say i want the results to look like this i mean, that is a result table, i just want the result returned,
the formula result must always be between 1 and 6
from the results table when :
intRunDiff = 1 and intRunCount = 1 then result = 1
intRunDiff = 5 and intRunCount = 3 then result = 5
etc...
intRunCount is always 1 to 6
intRunDiff can be 1 to anything
-
May 18th, 2005, 10:22 PM
#4
Re: formula needed...
You are right. I am confused.
Best to explain exactly what you want, and your chances of getting it will improve. In this case, you got what you asked for. 
To be continued...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|