+ Reply to Thread
Results 1 to 15 of 15

Indirect range reference at top of worksheet

  1. #1
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    6

    Indirect range reference at top of worksheet

    Hello,

    I am trying to reference a range of cells using indirect references. I need to use the same equation for the entire column. I want the range to shift with the cell it is entered in (which works), but with my current equation the range extends above the first cell in the worksheet it flips to the bottom.

    Equation used:
    =SUM(INDIRECT("R[-5]C[-1]:RC[-1]",0))

    When the equation is placed in B3, the interpreted range is $A$1:$A$1048573, when I would like it to be $A$1:$A$2.

    Any suggestions for modifications or alternate approaches would be greatly appreciated.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Indirect range reference at top of worksheet

    INDIRECT() is used to convert text into something that excel can use in a formula . Perhaps you need to look at OFFSET()? what exactly are you trying to do?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    6

    Re: Indirect range reference at top of worksheet

    Thanks for the reply.

    I think I might be able to use OFFSET the same effect but it still results in an error at the top of the worksheet.
    Per Microsoft: If rows and cols offset reference over the edge of the worksheet, OFFSET returns the #REF! error value.

    I am trying to create a single equation using relative cell references that will shift a range with it as it moves down the worksheet.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Indirect range reference at top of worksheet

    I don't understand what you're trying to achieve...

    Can you post a few examples of what you want the formula to look like using standard A1 style.

    You said
    Quote Originally Posted by p|q View Post
    When the equation is placed in B3, the interpreted range is $A$1:$A$1048573, when I would like it to be $A$1:$A$2.
    Add a few more examples
    In B4, I want it to be xxx
    In B10, I want it to be xxx
    etc..

  5. #5
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    6

    Re: Indirect range reference at top of worksheet

    I have attached an example spreadsheet that shows the result using INDIRECT and OFFSET equations as well as the result I am trying to produce. Thanks.

    IndirectRangeReference.xlsx

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Indirect range reference at top of worksheet

    whats wrong with just plain ol =SUM($A$2:A2)

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Indirect range reference at top of worksheet

    Try this in B2 and filled down

    =SUM(OFFSET(A2,0,0,-MIN(5,ROWS($1:1)),1))

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Indirect range reference at top of worksheet

    Quote Originally Posted by FDibbins View Post
    whats wrong with just plain ol =SUM($A$2:A2)
    The range should be limited to 5 cells..
    In B6 it's =SUM(A2:A6)
    but in B7 it's =SUM(A3:A7)

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Indirect range reference at top of worksheet

    oops missed that part, thanks Jonmo1

  10. #10
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    6

    Re: Indirect range reference at top of worksheet

    There are two issues with that approach (for my use). I am trying to create the equation for a database that will be created automatically with the same equation in each row of the column so I need to use relative cell references. I can create a functional equation that always starts the range at the top, but with 100,000+ rows of data its not practical.

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Indirect range reference at top of worksheet

    Can you make it so the data starts in Row 5?
    Then it's just =SUM(A1:A5) and filled down.

  12. #12
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    6

    Re: Indirect range reference at top of worksheet

    Quote Originally Posted by Jonmo1 View Post
    Try this in B2 and filled down

    =SUM(OFFSET(A2,0,0,-MIN(5,ROWS($1:1)),1))

    That did the trick, Thanks!

    I modified the equation so it only uses indirect references:
    =SUM(OFFSET(INDIRECT("RC[-2]",0),0,0,-MIN(5,ROWS($1:1)),1))

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Indirect range reference at top of worksheet

    Here's a version that looks exactly the same no matter which cell you put it in.

    =SUM(OFFSET($A$2,ROW()-2,0,-MIN(5,ROW()-1),1))

  14. #14
    Registered User
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    6

    Re: Indirect range reference at top of worksheet

    Perfect! That's actually better. Thanks!

  15. #15
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Indirect range reference at top of worksheet

    Glad to help.

    FYI, it's prone to give erroneous results if a row is inserted/deleted above row2

    The other one is actually 'better', but didn't quite satisfy your needs.

+ 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. Reference MATCH() or INDIRECT() from another worksheet?
    By criticalityevent in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-26-2013, 05:18 PM
  2. INDIRECT function to reference worksheet
    By mckaymmc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2011, 11:37 PM
  3. Indirect reference to changing worksheet name
    By Peanuts890 in forum Excel General
    Replies: 2
    Last Post: 05-21-2010, 09:52 AM
  4. Indirect reference to workbook and worksheet
    By Peanuts890 in forum Excel General
    Replies: 3
    Last Post: 05-04-2010, 06:54 PM
  5. SUM and INDIRECT to reference worksheet
    By Potatosalad2 in forum Excel General
    Replies: 2
    Last Post: 02-28-2006, 10:15 AM

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