Results 1 to 4 of 4

Thread: formula needed...

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2003
    Posts
    35

    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:
    1. For intRunCount = 1 To 6
    2.  For intRunDiff = 1 To intWhatever
    3.   <insert formula here>
    4.  Next intRunDiff
    5. 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 ...

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: formula needed...

    I'll let you work out the formatting. I think this is the right sequence, though.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. Dim intRunCount%, intRunDiff%, intWhatever%, x%
    5. intWhatever = 8
    6. For intRunCount = 1 To 6
    7.   Debug.Print vbCrLf & intRunCount & "  ";
    8.   For x = intRunCount To 1 Step -1
    9.     Debug.Print "  " & x;
    10.   Next x
    11.   x = 0
    12.  For intRunDiff = 1 To intWhatever
    13.   If x < intWhatever - intRunCount - 1 Then
    14.     Debug.Print "  " & intWhatever - intRunDiff;
    15.     x = x + 1
    16.   End If
    17.  Next intRunDiff
    18. Next intRunCount
    19. 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

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2003
    Posts
    35

    Talking 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

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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
  •  



Click Here to Expand Forum to Full Width