+ Reply to Thread
Results 1 to 3 of 3

Offset function and Dynamic Ranges

  1. #1
    SandyLACA
    Guest

    Offset function and Dynamic Ranges

    I just saw an example of this formula in an online newsletter:
    =OFFSET(Data!$A$1,0,0,COUNTA(Data!$A$1:$A$19),COUNTA(Data!$1:$1))
    I was trying it out and noticed that you have to place it with the upper
    left cell in cell A1 of a worksheet for it to reproduce the data that it
    refers to. Otherwise the #VALUE error appears. This is not how the OFFSET
    function usually works for me and it seems to have something to do with the
    COUNTA function appearing in the height and width arguments. I usually don't
    use the height and width arguments at all. Could someone explain why this is
    so and if there is a way to overcome this restriction?
    Thanks for your help,
    Sandy


  2. #2
    Bob Phillips
    Guest

    Re: Offset function and Dynamic Ranges

    It is not just A1, but any cell that maps onto that dynamic range, as it
    gets the value relative to the cell the formula is in.

    For example, if the data on the Data worksheet has 10 rows of data in column
    A, and 5 columns in row 1, this formula will work in any cell in the range
    A1:E10.

    --

    HTH

    Bob Phillips

    (replace xxxx in the email address with gmail if mailing direct)

    "SandyLACA" <[email protected]> wrote in message
    news:[email protected]...
    > I just saw an example of this formula in an online newsletter:
    > =OFFSET(Data!$A$1,0,0,COUNTA(Data!$A$1:$A$19),COUNTA(Data!$1:$1))
    > I was trying it out and noticed that you have to place it with the upper
    > left cell in cell A1 of a worksheet for it to reproduce the data that it
    > refers to. Otherwise the #VALUE error appears. This is not how the OFFSET
    > function usually works for me and it seems to have something to do with

    the
    > COUNTA function appearing in the height and width arguments. I usually

    don't
    > use the height and width arguments at all. Could someone explain why this

    is
    > so and if there is a way to overcome this restriction?
    > Thanks for your help,
    > Sandy
    >




  3. #3
    Valued Forum Contributor Excelenator's Avatar
    Join Date
    07-25-2006
    Location
    Wantagh, NY
    Posts
    333
    This formula is commonly used to dynamically name ranges of data that expand and contract (Mostly expand) frequently. This way you can always reference the data via the range name in formulas and as data sources for pivot tables etc.


    Quote Originally Posted by SandyLACA
    I just saw an example of this formula in an online newsletter:
    =OFFSET(Data!$A$1,0,0,COUNTA(Data!$A$1:$A$19),COUNTA(Data!$1:$1))
    I was trying it out and noticed that you have to place it with the upper
    left cell in cell A1 of a worksheet for it to reproduce the data that it
    refers to. Otherwise the #VALUE error appears. This is not how the OFFSET
    function usually works for me and it seems to have something to do with the
    COUNTA function appearing in the height and width arguments. I usually don't
    use the height and width arguments at all. Could someone explain why this is
    so and if there is a way to overcome this restriction?
    Thanks for your help,
    Sandy
    ---------------------------------------------------
    ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
    To insert code into the VBE (Visual Basic Editor)
    1. Copy the code.
    2. Open workbook to paste code into.
    3. Right click any worksheet tab, select View Code
    4. VBE (Visual Basic Editor) opens to that sheets object
    5. You may change to another sheets object or the This Workbook object by double clicking it in the Project window
    6. In the blank space below the word "General" paste the copied code.

+ 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