+ Reply to Thread
Results 1 to 7 of 7

Cell Addressing

  1. #1
    Registered User
    Join Date
    07-09-2008
    Location
    Texas
    MS-Off Ver
    2007
    Posts
    4

    Cell Addressing

    How would I go about using the value in one cell as part of a cell address or range of addresses? For example: cell a1 contains the value 20; and I want to use this value in this manner: sum(b"a1":b30). Or cell a1 contains 20 and cell a2 contains 35; sum("a1":"a2"). Or even a1=C and a2=10; then the cell address to be used in a different formula to use these two values as an address of c10. I've searched for hours and cannot find the answer, surely there must be some way to do this.

    a b c
    1 20
    2 35
    3
    4 sum(a20:a35)

    Hope this makes some kind of sense, I know what I want to do, just can't find the right way to word it. Thanks in advance,

    Glen B.
    [email protected].
    Last edited by gjblaha; 06-13-2009 at 11:43 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Cell Addressing

    You can use the INDIRECT() function in this manner to "piece" a reference together from string values and cell references.

    =SUM(INDIRECT("A" & B1 & ":A" & B2)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Cell Addressing

    More detail

    Quote Originally Posted by gjblaha View Post
    cell a1 contains the value 20; and I want to use this value in this manner: sum(b"a1":b30).
    =SUM(INDIRECT("B" & A1 & ":B30")

    Quote Originally Posted by gjblaha View Post
    Or cell a1 contains 20 and cell a2 contains 35;sum("a1":"a2")
    =SUM(INDIRECT("B"&A1&":B"&A2))

    Quote Originally Posted by gjblaha View Post
    Or even a1=C and a2=10;
    =SUM(INDIRECT(A1&"1:C"&A2))

    OR more case: a1="D2" , a2="E10" :
    =SUM(INDIRECT(A1&":"&A2))
    .

  4. #4
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Cell Addressing

    Quote Originally Posted by tigertiger View Post

    =SUM(INDIRECT(A1&"1:C"&A2))


    .
    Surely
    =SUM(INDIRECT(A1 & "1:" & A1 & A2))

    would be more apropriate?
    Regards
    Darren

    Update 12-Nov-2010 Still job hunting!

    If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.

    Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!


  5. #5
    Registered User
    Join Date
    07-09-2008
    Location
    Texas
    MS-Off Ver
    2007
    Posts
    4

    Re: Cell Addressing

    Thank you very much folks, obviously I was overlooking the INDIRECT command. Now I can spend additional hours happily playing with my new found knowledge from you.

  6. #6
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Cell Addressing

    Quote Originally Posted by squiggler47 View Post
    =SUM(INDIRECT(A1 & "1:" & A1 & A2))
    Well done, sometime man is crazy, I am not an exception, hii

  7. #7
    Registered User
    Join Date
    06-17-2009
    Location
    jhgdscv
    MS-Off Ver
    hgrdvhj
    Posts
    1

    Re: Cell Addressing

    thank you for this!

    good thing someone else had this problem before i did. instant solution, didn't need to wait. =)

    awesome explanations.

+ 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