Closed Thread
Results 1 to 10 of 10

Dynamic named range that expands "horizontally"

  1. #1
    Registered User
    Join Date
    06-02-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    80

    Dynamic named range that expands "horizontally"

    Hi,
    I know how to create a dynamic range that expands vertically in the same column. But, my data starts at cell I5 and is arranged in one row, and I keep adding new data to the side.
    I need to create a dynamic named range that expands horizontally.
    I appreciate it if someone provided the formula. Thanks

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,033

    Re: Dynamic named range that expands "horizontally"

    =OFFSET(I5,0,0,1,COUNTA(5:5))

    The CountA may need to be adjusted for any extra values in columns A to H, if those cells are not blank.

    =OFFSET(I5,0,0,1,COUNTA(5:5)-COUNTA(A5:H5))
    Bernie Deitrick
    Excel MVP 2000-2010

  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: Dynamic named range that expands "horizontally"

    =I2:INDEX(I2:XFD2,COUNTA(I2:XFD2)) should do it
    "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
    06-02-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Dynamic named range that expands "horizontally"

    Thanks Bernie Deitrick and martindwilson,

    It seems solution 2 of Bernie Deitrick is the closest so far. However, it is still not performing at 100% due to the special circumstances that I have.
    I have extra values before column I, but I also have extra values in additional tables to the far right after a column space.

    Is it possible to end the dynamic range at first blank without further expansion to the dynamic range?

    Currently, the desired dynamic range starts at I5 and ends at Q5. I have one blank column, and then another table starts.
    When I add new records, I “insert” new columns in between (at column R), shifting all tables on the right and so on. I need the dynamic range to expand then stop at the first blank without expanding to the adjacent table. Is this possible?

    I am attaching an example!!

    Horizontal range.xlsx

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

    Re: Dynamic named range that expands "horizontally"

    =$I$5:INDEX($I$5:$XFD$5,MATCH(TRUE,INDEX($I$5:$XFD$5="",0),0)-1)
    returns a range of i5:q5

  6. #6
    Registered User
    Join Date
    06-02-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Dynamic named range that expands "horizontally"

    Thanks martindwilson, it works perfect!!

    just couple of follow up questions since I am also learning from this. Is it also possible to accompolish it by any or both the following methods:

    - Can I replace I5 with named range? let us assume cell I5 called "Start_date" for example, what the formula would be?

    - Another scenario: If the named range is defined at cell H4 instead; "COG_VAL"; how the formula would be changed to if I need to reference "COG_VAL" by offsetting from it?

    Thanks a lot!

  7. #7
    Registered User
    Join Date
    09-02-2011
    Location
    Bulgaria
    MS-Off Ver
    2013
    Posts
    91

    Re: Dynamic named range that expands "horizontally"

    i want to create name range which expands horizontally

    the name range should refer to corresponding row where the formula uses the name range and it should be E:AI
    Truth fears no questions.

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,597

    Re: Dynamic named range that expands "horizontally"

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

  9. #9
    Registered User
    Join Date
    09-02-2011
    Location
    Bulgaria
    MS-Off Ver
    2013
    Posts
    91

    Re: Dynamic named range that expands "horizontally"

    Quote Originally Posted by JohnTopley View Post
    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    i apologize - just thought that it would be better if its in the same topic as its very similar case and users searching/monitoring the topic will be easier to find it
    will post new topic

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamic named range that expands "horizontally"

    Quote Originally Posted by godlev View Post
    i apologize - just thought that it would be better if its in the same topic as its very similar case and users searching/monitoring the topic will be easier to find it
    will post new topic
    That makes too much logical sense.

    Therefore, we won't do that here!
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to use named ranges in VBA code using "Columns" and a variation on "Range"
    By haljam in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2014, 02:48 PM
  2. [SOLVED] Vlookup on Dynamic Range that expands vertically and horizontally
    By huy_le in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-27-2013, 03:47 PM
  3. Named Range = "CountryA" OR "CountryB"
    By f0urchette in forum Excel General
    Replies: 0
    Last Post: 03-05-2012, 04:20 AM
  4. Replies: 3
    Last Post: 06-04-2011, 10:56 AM
  5. "Dynamic Named Range" in VLOOKUP
    By troyt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-04-2009, 03:52 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