+ Reply to Thread
Results 1 to 5 of 5

Adjust formula range based on other cell values

  1. #1
    Registered User
    Join Date
    10-12-2011
    Location
    Newfoundland and Labrador, Canada
    MS-Off Ver
    Office 2007
    Posts
    8

    Adjust formula range based on other cell values

    Given a simple formula in cell D3: =SUM($C5:$C20)

    Can the formula be written so that the row numbers (5 and 20 in this case) change based on other cell values?
    Let's say the desired start row and end row are stored in A3 and B3

    If A3 = 10 and B3 = 15, then the formula would behave as if it were written "=SUM($C10:$C15")
    Last edited by Sardius; 03-01-2012 at 03:10 PM. Reason: Issue resolved

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Adjust formula range based on other cell values

    Hi

    One way(using a helper column) is this.

    In E3>>="C"&A3

    iN e4>>="C"&B3

    Then use this formula:

    =SUM(INDIRECT(E3):INDIRECT(E4))

    Hope to helps you.
    Attached Files Attached Files
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Re: Adjust formula range based on other cell values

    May be another solution

    Please Login or Register  to view this content.
    Regard
    Attached Files Attached Files
    Mark the thread as solved if you are satisfied with the answer.


    In your first post under the thread tools.

    Mahju

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Adjust formula range based on other cell values

    Expanding fotis1991 solution a bit you could do it in one sweep without a helper column.

    Please Login or Register  to view this content.
    Alf

  5. #5
    Registered User
    Join Date
    10-12-2011
    Location
    Newfoundland and Labrador, Canada
    MS-Off Ver
    Office 2007
    Posts
    8

    Re: Adjust formula range based on other cell values

    I "discovered" a similar solution without needing the helper column. See linked file

    RangeFormula.xls

    This uses an alternate method to use numbers instead of a label to reference columns.

    To convert number to column header (B5 contains a number, not a column label):

    Please Login or Register  to view this content.
    And combining the two, it gets a bit lengthy but it is possible:

    Please Login or Register  to view this content.

+ 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