Consulting

Results 1 to 2 of 2

Thread: finding 12 numbers that'll give me the most result in a row of an array

  1. #1

    finding 12 numbers that'll give me the most result in a row of an array

    Hi,
    I have an exercise to solve.
    I have an array of 20 lines and in each line there are 6 random numbers from 1-37.
    I need to find 12 numbers that will maximize the times thatall 6 numbers in a row Are between my 12 numbers

    I am attaching a sample file,
    in the example the 12 numbers 1,8,12,13,19,27,28,30,33,34,35,37 are at 6 full row numbers 2,8,9 ( lines mark in red)

    I am looking for a way to find the 12 numbers that will maximize the lines that all 6 numbers are in my 12 numbers,

    Thanks

    Attached Files Attached Files

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Kamn,

    Welcome to VBA Express. We don't do homework, but we will help you work your own way through it.

    I suggest you consider a method to store winning numbers; A winning number count loop; Inside that loop, a winning number count limit loop; And inside that, a number existence loop.

    Evrey time a number count limit is reached, store that number and increment the Winning number count loop.
    [VBA]
    For 1 to 12
    For 6 to 1
    For 1 to 37
    For each cell Then If cell = 1-37 then counter = counter + 1
    If counter = limit Then store number
    [/VBA]
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •