+ Reply to Thread
Results 1 to 4 of 4

Dynamicaly sized array from single cell values

Hybrid View

  1. #1
    Registered User
    Join Date
    12-09-2009
    Location
    OGLE-2005-BLG-390Lb
    MS-Off Ver
    Excel 2002
    Posts
    2

    Dynamicaly sized array from single cell values

    I want to make an dynamic array of evenly spaced values. A Max and a Min is given and stored in two cells. And another value for number of intervals.
    So for example, the following is given:
    Min=25
    Max=100
    N=3


    and I need an output of a Nx1 array with the values:
    25
    50
    75
    100


    So far, I've been implementing this with {=Min+{0;1;2;3}*Interval}
    Where Interval = (Max-Min)/N

    But problem is I need to be able to change N and have the array change to {=Min+{0;1;2;3;...;N}*Interval}.

    So the question is, how do I generate an Nx1 array?

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Dynamicaly sized array from single cell values

    Hi,

    how many cells would the array span at most? Highlight all these cells and then enter

    {=IF(min+(ROW()-1)*interval>max,0,min+(ROW()-1)*interval)}

    confirmed with CSE

    with this formula the array starts in row 1. If you start the array in another row, adjust it so:, for example array starts in row 5

    {=IF(min+(ROW()-5)*interval>max,0,min+(ROW()-5)*interval)}

    You can format the array with custom format

    0;;;

    to suppress unwanted zeros in the unused array cells.

    Would that work for you?

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Dynamicaly sized array from single cell values

    try percentile see attached formula in yellow cells dragged across if you want to go down change columns($a$1:a1) to rows($a$1:a1)
    Attached Files Attached Files
    Last edited by martindwilson; 12-09-2009 at 06:49 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    12-09-2009
    Location
    OGLE-2005-BLG-390Lb
    MS-Off Ver
    Excel 2002
    Posts
    2

    Re: Dynamicaly sized array from single cell values

    THANKS!!! both work great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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