+ Reply to Thread
Results 1 to 9 of 9

Using Index for a dynamic range

  1. #1
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Using Index for a dynamic range

    I know this sounds like a dumb question but I have really looked all over and I am hoping someone can quickly bring back my sanity.

    Hoe do I create a dynamic range for a whole sheet using indirect? Everything I see uses just a range for a column or for rows. I found one that uses a formula that can go down 65536 rows, but Excel 2007 can do many more rows than that. =Sheet1!$A$1:INDEX(Sheet1!$1:$65536,COUNTA(Sheet1!$A:$A),COUNTA(Sheet1!$1:$1))

    I have seen many places that index should be used instead of offset for a dynamic range, but I can't figure out how to get index to look at the whole spreadsheet. Offset was easy, I can tell it to start at A1 and mover over and down using counta. With index I have to tell it the range to look in, but I don't know the range beforehand. I just know that data starts in A1. It could have any number of rows or columns.

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

    Re: Using Index for a dynamic range

    well the whole sheet would be
    Sheet1!1:1048576
    "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

  3. #3
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Using Index for a dynamic range

    That will work. I don't know why that was so hard to find.

    Is there a better way to do this formula so that in the future I don't have to go in and change the maximum rows?

  4. #4
    Registered User
    Join Date
    10-25-2014
    Location
    Orange County, California
    MS-Off Ver
    Office 365
    Posts
    35

    Re: Using Index for a dynamic range

    Just curious. If you select the whole sheet, how can it be "dynamic". It can't grow by rows or columns.

  5. #5
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Using Index for a dynamic range

    I don't want to "select" the whole sheet. I just want the formula to look at the whole sheet to determine where the last row and column are.

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

    Re: Using Index for a dynamic range

    @pistulka same as specifying the whole column i suppose
    the actual range used is the same length as the counta
    so

    =Sheet1!$A$1:INDEX(sheet1!a:a,COUNTA(Sheet1!$A:$A) with stuff in a1 through to a10
    resolves to a1:a10

    =Sheet1!$A$1:INDEX(Sheet1!$1:$65536,COUNTA(Sheet1!$A:$A),COUNTA(Sheet1!$1:$1))
    with stuffin a1,a2,b1,b2
    resolves to Sheet1!$A$1:b2
    Last edited by martindwilson; 11-04-2014 at 05:09 AM.

  7. #7
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    wales
    MS-Off Ver
    Excel 2007
    Posts
    964

    Re: Using Index for a dynamic range

    here is a little on INDEX if you click my sig might help some (although it wouldn't have answered your full sheet question.)

    http://www.excelforum.com/tips-and-t...ml#post3882837
    The Importance of INDEX - A GUIDE TO INDEX'S OTHER USES
    <--- If a post helps hit the star

  8. #8
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Using Index for a dynamic range

    For now I like what martindwilson suggested. This formula works: =Sheet1!$A$1:INDEX(Sheet1!$1:$1048576,COUNTA(Sheet1!$A:$A),COUNTA(Sheet1!$1:$1))
    I don't like hard coding in the max number of rows, but when I paste a set of data into this spreadsheet, I can just reference the named range and it will always update to include all of the rows and columns in the set of data.

    Thank you for your help!

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

    Re: Using Index for a dynamic range

    once you type index( in a formula just click to select the sheet you need click to select whole sheet(the bit above row 1 and left of col A)
    it will auto fill the value according to the max size of the workbook being used

+ 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. [SOLVED] Using INDIRECT with a dynamic range name as the array in an INDEX formulae = #REF
    By Gandalf21 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-12-2013, 09:27 AM
  2. Vba index and match for dynamic range
    By _google in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-20-2013, 10:25 AM
  3. Dynamic Range issues with index/match(i think)
    By Furby in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-11-2013, 08:18 AM
  4. dynamic range by column index
    By the666bbq in forum Excel General
    Replies: 2
    Last Post: 03-14-2011, 12:03 PM
  5. dynamic range for index/match formula
    By excellicious in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-29-2008, 07:41 PM

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