+ Reply to Thread
Results 1 to 6 of 6

Skip number in sequence

  1. #1
    Registered User
    Join Date
    11-09-2016
    Location
    London, England
    MS-Off Ver
    2010/2016
    Posts
    72

    Skip number in sequence

    Hey,

    I'm doing this:

    Please Login or Register  to view this content.
    The values for CHOOSE are hard coded at the moment, but I need them to be dynamic. The count parameter for RandBetween is a cell value. This could change, and then in turn the number of values for CHOOSE.

    If the start number is, in this case, 5, how would I get the next values to be mulpitples of 5? The start number can be anything, and is based on a rounded division of a total value and a count value.

    So:

    if the total is 68 and count is 11 the result is 6.18, rounded to 6. So there should be 11 multiples of 6 for the values for CHOOSE.

    If the total is 70 and the count is 10, the result is 7. So there should be 10 mulitples of 7 for the values for CHOOSE.

    Building the string of values I can do. But using that string (comma separated) in CHOOSE doesn't work.

    Is that possible? To pass a dynamic number of arguments to CHOOSE?

    Thanks!
    Last edited by ldoodle; 11-17-2016 at 07:51 AM.

  2. #2
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Skip number in sequence

    I think this code can also solve the purpose...

    Please Login or Register  to view this content.
    Or are you specifically willing to use CHOOSE?

    Regards
    Sourabh

    PS - I just saw that you are skipping a number in between, how to decide which number to skip?
    Last edited by sourabhg98; 11-17-2016 at 08:15 AM.
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  3. #3
    Registered User
    Join Date
    11-09-2016
    Location
    London, England
    MS-Off Ver
    2010/2016
    Posts
    72

    Re: Skip number in sequence

    Thanks for the reply.

    This is what I've got so far. I've managed to ditch CHOOSE and use INDEX instead, as I can pass an array to it.

    Please Login or Register  to view this content.
    The only problem now, is the first element in the array is always blank, so the first number written out is blank.

    If I change the For...Loop to start at 0, the first element is 0, not 6?
    Last edited by ldoodle; 11-17-2016 at 08:51 AM.

  4. #4
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Skip number in sequence

    You can declare the array as follows-
    Please Login or Register  to view this content.
    This will begin from 1 not 0.

    However, I am still curious to know why are you going into creating an array and then choosing a random number. We can even do it directly like this-

    Please Login or Register  to view this content.
    Does this not return the same?
    Last edited by sourabhg98; 11-17-2016 at 09:06 AM.

  5. #5
    Registered User
    Join Date
    11-09-2016
    Location
    London, England
    MS-Off Ver
    2010/2016
    Posts
    72

    Re: Skip number in sequence

    Thanks. The Redim y(1 to count) works. I will try your other method and see how I get on.
    Last edited by ldoodle; 11-17-2016 at 08:59 AM.

  6. #6
    Registered User
    Join Date
    11-09-2016
    Location
    London, England
    MS-Off Ver
    2010/2016
    Posts
    72

    Re: Skip number in sequence

    Quote Originally Posted by sourabhg98 View Post
    Does this not return the same?
    Yes it does. Good work sir!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 06-08-2015, 08:39 AM
  2. How do you fill a series of cell references and skip four to produce a sequence
    By john dalton in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-02-2014, 07:25 AM
  3. [SOLVED] Function to skip the process if the sequence number is missing
    By Thinker8 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-15-2014, 08:20 AM
  4. Replies: 6
    Last Post: 11-26-2013, 05:21 PM
  5. Replies: 5
    Last Post: 11-22-2010, 06:31 PM
  6. How can I match a random number with closest number from sequence?
    By matt in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-02-2006, 08:25 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1