+ Reply to Thread
Results 1 to 5 of 5

Dyamic range - selecting the starting value

Hybrid View

  1. #1
    Registered User
    Join Date
    04-19-2010
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    86

    Dyamic range - selecting the starting value

    Hi Guys -

    So I have this dynamic range, I'm sure you can see what it does:

    =OFFSET(Visits!$A$4, 0, COUNTA(Visits!$4:$4)-1, 1,-MIN(chtLen,COUNTA(Visits!$4:$4))-1)
    chtLen is the number of months, as selected by the user.

    So this formula currently selects cell A4, goes right to the end of the last entry in that row, goes back one cell, and for the width of the range goes back the specified in the number of months they have selected.

    However, I want to do this differently. Rather than the above, I want to achieve this:

    Depending on a month and year selected, the range starts at a relevant column, then goes back for the number of months selected. Is this possible?

    So for example:

    The user selects August 2012, the value of which is in column 5 (E) of the source data. This column number is returned using a MATCH formula:

    =MATCH(Traffic!F3,Visits!$1:$1,0)
    I can specifiy a fixed row number here (4).

    So, in this case I want the range to start from cell E4, then go back the length selected (chtLen).

    So I guess instead of the fixed cell (A4) in the OFFSET formula above, it would need to reference the starting cell (which depends on the month/year selected): this starting cell would be found using the MATCH formula for the column number, and the row number can be specified as a number.

    If this doesn't make sense I will mock up a spreadsheet, as the one I have built contains sensitive data.

    Thanks,
    John

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dyamic range - selecting the starting value

    Are you meaning?

    =OFFSET(INDEX(Visits!$4:$4,MATCH(Traffic!F3,Visits!$1:$1,0)), 0, COUNTA(Visits!$4:$4)-1, 1,-MIN(chtLen,COUNTA(Visits!$4:$4))-1)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    04-19-2010
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    86

    Re: Dyamic range - selecting the starting value

    Actually, I've just realised there was an error or two:

    1) If chtLen is higher that the number of columns left of the starting column, this causes no cells to be selected.
    2) Column a contains row name (Visits, Page Views, etc). This is sometimes included in the range. Can this be excluded?

    Thanks,
    John

  4. #4
    Registered User
    Join Date
    04-19-2010
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    86

    Re: Dyamic range - selecting the starting value

    Awesome - that was perfect, just needed a slight modification (when the last column is selected, no need to move to right any columns).

    =OFFSET(INDEX(Visits!$4:$4,MATCH(Traffic!F3,Visits!$1:$1,0)), 0, 0, 1,-MIN(chtLen,COUNTA(Visits!$4:$4))-1)
    Thanks so Much!!!!

    John

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dyamic range - selecting the starting value

    Maybe it would be easier if I saw the workbook or sample and you let me know what to do to duplicate these issues...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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