+ Reply to Thread
Results 1 to 6 of 6

Using formula to calculate cell reference

  1. #1
    Registered User
    Join Date
    10-12-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Using formula to calculate cell reference

    Hi, it would really help if I could crack this one. Is it possible to use a formula to calculate a cell reference within a formula? e.g. is there some way I could reference cell C47 in a formula by saying C(40+A2) where A2 contains the value 7. I often want to sum a certain number of cells in a list, from the first one to the nth one and need to be able to calculate rather than hard-code n. Hope that makes sense and hope someone can help!

    Thanks.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,177

    Re: Using formula to calculate cell reference

    =INDIRECT("C" & (40 + A2))

    Regards
    Last edited by TMS; 10-12-2010 at 07:39 AM. Reason: Change cell reference A7 to A2
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Using formula to calculate cell reference

    I would advise use of INDEX

    Please Login or Register  to view this content.
    You can also use OFFSET

    Please Login or Register  to view this content.
    but like INDIRECT OFFSET is also Volatile (see link in sig. for more info on Volatility)

  4. #4
    Registered User
    Join Date
    10-12-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Using formula to calculate cell reference

    Perfect. Many thanks indeed.

  5. #5
    Registered User
    Join Date
    07-14-2014
    Location
    Manchester, England
    MS-Off Ver
    2013
    Posts
    1

    Re: Using formula to calculate cell reference

    Sorry to be thick, but could someone please explain how the fields in the INDEX and OFFSET suggestions relate to the problem as originally posed. E.g. where does 'C' mean 'Column C' (so the row number of the cell still needs to be specified)' and where does it simply mean 'Column' (so that what follows is a computation of the column number) ? Where does 'C1' come from, and what does 'C:C' mean ?
    As a septuagenarian, I found the descriptions of INDEX and OFFSET in the standard Excel online help quite impenetrable.

  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: Using formula to calculate cell reference

    deVIAous, welcome to the forum, and congrats on being here

    Normally we would ask for a new thread on your question, but seeing as how you are just asking for how the formulas work, we will let that slide

    If you mean the C in this...
    =INDIRECT("C" & (40 + A2))

    INDIRECT() is excel's function for tranlating text into something that excel can use as a reference in a formula, so that translates to a cell reference in Column C that is in row 40 + whatever value is in A2. So if A2 contains 10, then =INDIRECT("C" & (40 + A2)) is the same as the reference =C50 (40+10)

    OFFSET() is used to create a reference (or a range) that a specified number of rows and columns from a designated starting cell, and (for a range) is a specified number of rows high and number of columns wide...

    =SUM(OFFSET(C1,,,40+A2,1))

    this is creating a range (to sum), that has its start in C1, goes down zero rows and across zero columns (to determine the starting point), then creates a range that is 40+A2 rows deep and 1 column wide

    Make sense?
    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 3 users browsing this thread. (0 members and 3 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